diff --git a/Microsoft.ML.sln b/Microsoft.ML.sln
index 3f197a955b..759ef2e8f6 100644
--- a/Microsoft.ML.sln
+++ b/Microsoft.ML.sln
@@ -1,4 +1,4 @@
-Microsoft Visual Studio Solution File, Format Version 12.00
+Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.1.32120.378
MinimumVisualStudioVersion = 10.0.40219.1
@@ -123,6 +123,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.ML.AutoML", "src\
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.ML.AutoML.Samples", "docs\samples\Microsoft.ML.AutoML.Samples\Microsoft.ML.AutoML.Samples.csproj", "{A6924919-9E37-4023-8B7F-E85C8E3CC9B3}"
EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.ML.AutoML.Interactive", "src\Microsoft.ML.AutoML.Interactive\Microsoft.ML.AutoML.Interactive.csproj", "{3B00090A-B5E4-4570-BCD0-B4CD5D499394}"
+EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.ML.Samples.GPU", "docs\samples\Microsoft.ML.Samples.GPU\Microsoft.ML.Samples.GPU.csproj", "{3C8F910B-7F23-4D25-B521-6D5AC9570ADD}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.ML.Featurizers", "src\Microsoft.ML.Featurizers\Microsoft.ML.Featurizers.csproj", "{E2DD0721-5B0F-4606-8182-4C7EFB834518}"
@@ -157,7 +159,13 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.ML.SearchSpace.Te
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.ML.AutoML.SourceGenerator", "tools-local\Microsoft.ML.AutoML.SourceGenerator\Microsoft.ML.AutoML.SourceGenerator.csproj", "{C804B990-390E-41D7-8FF1-6774495D70E2}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.ML.TorchSharp", "src\Microsoft.ML.TorchSharp\Microsoft.ML.TorchSharp.csproj", "{FF0BD187-4451-4A3B-934B-2AE3454896E2}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.ML.TorchSharp", "src\Microsoft.ML.TorchSharp\Microsoft.ML.TorchSharp.csproj", "{FF0BD187-4451-4A3B-934B-2AE3454896E2}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.ML.Tokenizers", "src\Microsoft.ML.Tokenizers\Microsoft.ML.Tokenizers.csproj", "{BBC3A950-BD68-45AC-9DBD-A8F4D8847745}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.ML.Tokenizers.Tests", "test\Microsoft.ML.Tokenizers.Tests\Microsoft.ML.Tokenizers.Tests.csproj", "{C3D82402-F207-4F19-8C57-5AF0FBAF9682}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.ML.XGBoost", "src\Microsoft.ML.XGBoost\Microsoft.ML.XGBoost.csproj", "{9CF22D6B-3094-4F42-9CBF-1B07087CF1EE}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -607,6 +615,14 @@ Global
{A6924919-9E37-4023-8B7F-E85C8E3CC9B3}.Release|Any CPU.Build.0 = Release|Any CPU
{A6924919-9E37-4023-8B7F-E85C8E3CC9B3}.Release|x64.ActiveCfg = Release|Any CPU
{A6924919-9E37-4023-8B7F-E85C8E3CC9B3}.Release|x64.Build.0 = Release|Any CPU
+ {3B00090A-B5E4-4570-BCD0-B4CD5D499394}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {3B00090A-B5E4-4570-BCD0-B4CD5D499394}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {3B00090A-B5E4-4570-BCD0-B4CD5D499394}.Debug|x64.ActiveCfg = Debug|Any CPU
+ {3B00090A-B5E4-4570-BCD0-B4CD5D499394}.Debug|x64.Build.0 = Debug|Any CPU
+ {3B00090A-B5E4-4570-BCD0-B4CD5D499394}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {3B00090A-B5E4-4570-BCD0-B4CD5D499394}.Release|Any CPU.Build.0 = Release|Any CPU
+ {3B00090A-B5E4-4570-BCD0-B4CD5D499394}.Release|x64.ActiveCfg = Release|Any CPU
+ {3B00090A-B5E4-4570-BCD0-B4CD5D499394}.Release|x64.Build.0 = Release|Any CPU
{3C8F910B-7F23-4D25-B521-6D5AC9570ADD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3C8F910B-7F23-4D25-B521-6D5AC9570ADD}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3C8F910B-7F23-4D25-B521-6D5AC9570ADD}.Debug|x64.ActiveCfg = Debug|Any CPU
@@ -747,6 +763,30 @@ Global
{FF0BD187-4451-4A3B-934B-2AE3454896E2}.Release|Any CPU.Build.0 = Release|Any CPU
{FF0BD187-4451-4A3B-934B-2AE3454896E2}.Release|x64.ActiveCfg = Release|Any CPU
{FF0BD187-4451-4A3B-934B-2AE3454896E2}.Release|x64.Build.0 = Release|Any CPU
+ {BBC3A950-BD68-45AC-9DBD-A8F4D8847745}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {BBC3A950-BD68-45AC-9DBD-A8F4D8847745}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {BBC3A950-BD68-45AC-9DBD-A8F4D8847745}.Debug|x64.ActiveCfg = Debug|Any CPU
+ {BBC3A950-BD68-45AC-9DBD-A8F4D8847745}.Debug|x64.Build.0 = Debug|Any CPU
+ {BBC3A950-BD68-45AC-9DBD-A8F4D8847745}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {BBC3A950-BD68-45AC-9DBD-A8F4D8847745}.Release|Any CPU.Build.0 = Release|Any CPU
+ {BBC3A950-BD68-45AC-9DBD-A8F4D8847745}.Release|x64.ActiveCfg = Release|Any CPU
+ {BBC3A950-BD68-45AC-9DBD-A8F4D8847745}.Release|x64.Build.0 = Release|Any CPU
+ {C3D82402-F207-4F19-8C57-5AF0FBAF9682}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {C3D82402-F207-4F19-8C57-5AF0FBAF9682}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {C3D82402-F207-4F19-8C57-5AF0FBAF9682}.Debug|x64.ActiveCfg = Debug|Any CPU
+ {C3D82402-F207-4F19-8C57-5AF0FBAF9682}.Debug|x64.Build.0 = Debug|Any CPU
+ {C3D82402-F207-4F19-8C57-5AF0FBAF9682}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {C3D82402-F207-4F19-8C57-5AF0FBAF9682}.Release|Any CPU.Build.0 = Release|Any CPU
+ {C3D82402-F207-4F19-8C57-5AF0FBAF9682}.Release|x64.ActiveCfg = Release|Any CPU
+ {C3D82402-F207-4F19-8C57-5AF0FBAF9682}.Release|x64.Build.0 = Release|Any CPU
+ {9CF22D6B-3094-4F42-9CBF-1B07087CF1EE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {9CF22D6B-3094-4F42-9CBF-1B07087CF1EE}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {9CF22D6B-3094-4F42-9CBF-1B07087CF1EE}.Debug|x64.ActiveCfg = Debug|Any CPU
+ {9CF22D6B-3094-4F42-9CBF-1B07087CF1EE}.Debug|x64.Build.0 = Debug|Any CPU
+ {9CF22D6B-3094-4F42-9CBF-1B07087CF1EE}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {9CF22D6B-3094-4F42-9CBF-1B07087CF1EE}.Release|Any CPU.Build.0 = Release|Any CPU
+ {9CF22D6B-3094-4F42-9CBF-1B07087CF1EE}.Release|x64.ActiveCfg = Release|Any CPU
+ {9CF22D6B-3094-4F42-9CBF-1B07087CF1EE}.Release|x64.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -806,6 +846,7 @@ Global
{C2652287-CD6D-40FB-B042-95FB56D09DB8} = {AED9C836-31E3-4F3F-8ABC-929555D3F3C4}
{E48285BF-F49A-4EA3-AED0-1BDDBF77EB80} = {09EADF06-BE25-4228-AB53-95AE3E15B530}
{A6924919-9E37-4023-8B7F-E85C8E3CC9B3} = {DA452A53-2E94-4433-B08C-041EDEC729E6}
+ {3B00090A-B5E4-4570-BCD0-B4CD5D499394} = {09EADF06-BE25-4228-AB53-95AE3E15B530}
{3C8F910B-7F23-4D25-B521-6D5AC9570ADD} = {DA452A53-2E94-4433-B08C-041EDEC729E6}
{E2DD0721-5B0F-4606-8182-4C7EFB834518} = {09EADF06-BE25-4228-AB53-95AE3E15B530}
{56CB0850-7341-4D71-9AE4-9EFC472D93DD} = {09EADF06-BE25-4228-AB53-95AE3E15B530}
@@ -824,6 +865,9 @@ Global
{A3E9F25F-2718-4FF9-A35A-54C232A847AB} = {AED9C836-31E3-4F3F-8ABC-929555D3F3C4}
{C804B990-390E-41D7-8FF1-6774495D70E2} = {7F13E156-3EBA-4021-84A5-CD56BA72F99E}
{FF0BD187-4451-4A3B-934B-2AE3454896E2} = {09EADF06-BE25-4228-AB53-95AE3E15B530}
+ {BBC3A950-BD68-45AC-9DBD-A8F4D8847745} = {09EADF06-BE25-4228-AB53-95AE3E15B530}
+ {C3D82402-F207-4F19-8C57-5AF0FBAF9682} = {AED9C836-31E3-4F3F-8ABC-929555D3F3C4}
+ {9CF22D6B-3094-4F42-9CBF-1B07087CF1EE} = {09EADF06-BE25-4228-AB53-95AE3E15B530}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {41165AF1-35BB-4832-A189-73060F82B01D}
diff --git a/NuGet.config b/NuGet.config
index 976d8d3441..ffcdda42a0 100644
--- a/NuGet.config
+++ b/NuGet.config
@@ -5,6 +5,7 @@
+
@@ -13,6 +14,7 @@
+
diff --git a/THIRD-PARTY-NOTICES.TXT b/THIRD-PARTY-NOTICES.TXT
index ae6f0a7ec3..49d4e0c2a8 100644
--- a/THIRD-PARTY-NOTICES.TXT
+++ b/THIRD-PARTY-NOTICES.TXT
@@ -65,4 +65,23 @@ INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PA
PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-DEALINGS IN THE SOFTWARE.
\ No newline at end of file
+DEALINGS IN THE SOFTWARE.
+
+License notice for HuggingFace Tokenizers
+------------------------------------------
+
+https://github.com/huggingface/tokenizers/blob/main/LICENSE
+
+Copyright 2004 HuggingFace Tokenizers
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
\ No newline at end of file
diff --git a/build/.night-build.yml b/build/.night-build.yml
index 1f3ae20269..442a2bbf4e 100644
--- a/build/.night-build.yml
+++ b/build/.night-build.yml
@@ -64,7 +64,7 @@ jobs:
buildScript: ./build.sh
nightlyBuild: true
pool:
- vmImage: macOS-10.15
+ vmImage: macOS-12
- template: /build/ci/job-template.yml
parameters:
@@ -117,4 +117,4 @@ jobs:
buildScript: build.cmd
nightlyBuild: true
pool:
- vmImage: windows-2019
\ No newline at end of file
+ vmImage: windows-2019
diff --git a/build/ci/job-template.yml b/build/ci/job-template.yml
index 09cb464776..89f81e66eb 100644
--- a/build/ci/job-template.yml
+++ b/build/ci/job-template.yml
@@ -20,7 +20,7 @@ jobs:
${{ if eq(parameters.nightlyBuild, 'true') }}:
timeoutInMinutes: 30
${{ if and(eq(parameters.nightlyBuild, 'false'), eq(parameters.codeCoverage, 'false')) }}:
- timeoutInMinutes: 90
+ timeoutInMinutes: 120
${{ if eq(parameters.codeCoverage, 'true') }}:
timeoutInMinutes: 120
cancelTimeoutInMinutes: 10
@@ -239,4 +239,4 @@ jobs:
displayName: Clean up runtime folder for package (Unix)
- ${{ if eq(parameters.nightlyBuild, 'false') }}:
- script: ${{ parameters.buildScript }} /p:Build=false -pack -ci -configuration $(_configuration) /p:TargetArchitecture=${{ parameters.architecture }} /p:TestArchitectures=${{ parameters.architecture }} $(testTargetFramework)
- displayName: Build Packages
\ No newline at end of file
+ displayName: Build Packages
diff --git a/build/vsts-ci.yml b/build/vsts-ci.yml
index fca74af788..dc6590f4be 100644
--- a/build/vsts-ci.yml
+++ b/build/vsts-ci.yml
@@ -119,13 +119,8 @@ jobs:
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1
DOTNET_MULTILEVEL_LOOKUP: 0
pool:
- vmImage: macOS-10.15
+ vmImage: macOS-12
steps:
- # Work around MacOS Homebrew image/environment bug: https://github.com/actions/virtual-environments/issues/2322#issuecomment-749211076
- - script: |
- rm -rf /usr/local/bin/2to3
- displayName: MacOS Homebrew bug Workaround
- continueOnError: true
- script: brew update && brew unlink python@3.8 && brew install mono-libgdiplus && brew install $(Build.SourcesDirectory)/build/libomp.rb --build-from-source --formula && brew link libomp --force
displayName: Install build dependencies
- script: ./restore.sh
@@ -155,7 +150,7 @@ jobs:
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1
DOTNET_MULTILEVEL_LOOKUP: 0
pool:
- vmImage: macOS-10.15
+ vmImage: macOS-12
steps:
# Work around MacOS Homebrew image/environment bug: https://github.com/actions/virtual-environments/issues/2322#issuecomment-749211076
- script: |
diff --git a/docs/api-reference/algo-details-fasttree.md b/docs/api-reference/algo-details-fasttree.md
index 54985d89d2..7bc710e2c7 100644
--- a/docs/api-reference/algo-details-fasttree.md
+++ b/docs/api-reference/algo-details-fasttree.md
@@ -35,6 +35,6 @@ For more information see:
* [Wikipedia: Gradient boosting (Gradient tree
boosting).](https://en.wikipedia.org/wiki/Gradient_boosting#Gradient_tree_boosting)
* [Greedy function approximation: A gradient boosting
-machine.](https://projecteuclid.org/DPubS?service=UI&version=1.0&verb=Display&handle=euclid.aos/1013203451)
+machine.](https://projecteuclid.org/journals/annals-of-statistics/volume-29/issue-5/Greedy-function-approximation-A-gradient-boostingmachine/10.1214/aos/1013203451.full)
-Check the See Also section for links to examples of the usage.
\ No newline at end of file
+Check the See Also section for links to examples of the usage.
diff --git a/docs/samples/Microsoft.ML.AutoML.Samples/Cifar10.cs b/docs/samples/Microsoft.ML.AutoML.Samples/Cifar10.cs
new file mode 100644
index 0000000000..cda207ec09
--- /dev/null
+++ b/docs/samples/Microsoft.ML.AutoML.Samples/Cifar10.cs
@@ -0,0 +1,56 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Text;
+
+namespace Microsoft.ML.AutoML.Samples
+{
+ public static class Cifar10
+ {
+ public static string cifar10FolderPath = Path.Combine(Path.GetTempPath(), "cifar10");
+ public static string cifar10ZipPath = Path.Combine(Path.GetTempPath(), "cifar10.zip");
+ public static string cifar10Url = @"https://github.com/YoongiKim/CIFAR-10-images/archive/refs/heads/master.zip";
+ public static string directory = "CIFAR-10-images-master";
+
+ public static void Run()
+ {
+ var imageInputs = Directory.GetFiles(cifar10FolderPath)
+ .Where(p => Path.GetExtension(p) == ".jpg")
+ .Select(p => new ModelInput
+ {
+ ImagePath = p,
+ Label = p.Split("\\").SkipLast(1).Last(),
+ });
+
+ var testImages = imageInputs.Where(f => f.ImagePath.Contains("test"));
+ var trainImages = imageInputs.Where(f => f.ImagePath.Contains("train"));
+ var context = new MLContext();
+ context.Log += (e, o) =>
+ {
+ if (o.Source.StartsWith("AutoMLExperiment"))
+ Console.WriteLine(o.Message);
+ };
+
+ var trainDataset = context.Data.LoadFromEnumerable(trainImages);
+ var testDataset = context.Data.LoadFromEnumerable(testImages);
+ var experiment = context.Auto().CreateExperiment();
+ var pipeline = context.Auto().Featurizer(trainDataset)
+ .Append(context.Auto().MultiClassification());
+
+ experiment.SetDataset(trainDataset, testDataset)
+ .SetPipeline(pipeline)
+ .SetMulticlassClassificationMetric(MulticlassClassificationMetric.MicroAccuracy)
+ .SetTrainingTimeInSeconds(200);
+
+ var result = experiment.Run();
+ }
+
+ class ModelInput
+ {
+ public string ImagePath { get; set; }
+
+ public string Label { get; set; }
+ }
+ }
+}
diff --git a/docs/samples/Microsoft.ML.AutoML.Samples/Microsoft.ML.AutoML.Samples.csproj b/docs/samples/Microsoft.ML.AutoML.Samples/Microsoft.ML.AutoML.Samples.csproj
index 9d511df6a5..1c4da82682 100644
--- a/docs/samples/Microsoft.ML.AutoML.Samples/Microsoft.ML.AutoML.Samples.csproj
+++ b/docs/samples/Microsoft.ML.AutoML.Samples/Microsoft.ML.AutoML.Samples.csproj
@@ -10,6 +10,7 @@
+
diff --git a/docs/samples/Microsoft.ML.AutoML.Samples/Program.cs b/docs/samples/Microsoft.ML.AutoML.Samples/Program.cs
index 4342873c64..646c3546ae 100644
--- a/docs/samples/Microsoft.ML.AutoML.Samples/Program.cs
+++ b/docs/samples/Microsoft.ML.AutoML.Samples/Program.cs
@@ -23,6 +23,9 @@ public static void Main(string[] args)
RankingExperiment.Run();
Console.Clear();
+ Cifar10.Run();
+ Console.Clear();
+
Console.WriteLine("Done");
}
catch (Exception ex)
diff --git a/docs/samples/Microsoft.ML.Samples/Dynamic/Trainers/BinaryClassification/PriorTrainer.cs b/docs/samples/Microsoft.ML.Samples/Dynamic/Trainers/BinaryClassification/PriorTrainer.cs
index e2c0da3f32..f0225cc34f 100644
--- a/docs/samples/Microsoft.ML.Samples/Dynamic/Trainers/BinaryClassification/PriorTrainer.cs
+++ b/docs/samples/Microsoft.ML.Samples/Dynamic/Trainers/BinaryClassification/PriorTrainer.cs
@@ -38,6 +38,27 @@ public static void Example()
// Run the model on test data set.
var transformedTestData = model.Transform(testData);
+
+#if true
+ var predLabelColumn = transformedTestData.Schema["PredictedLabel"];
+ var scoreColumn = transformedTestData.Schema["Score"];
+ var probColumn = transformedTestData.Schema["Probability"];
+
+ bool predLabelVal = default(bool);
+ float scoreVal = default(float);
+ using (var cursor = transformedTestData.GetRowCursor(new[] { predLabelColumn, scoreColumn, probColumn }))
+ {
+ var predLabelGetter = cursor.GetGetter(predLabelColumn);
+ var scoreGetter = cursor.GetGetter(scoreColumn);
+ while (cursor.MoveNext())
+ {
+ predLabelGetter(ref predLabelVal);
+ scoreGetter(ref scoreVal);
+ Console.WriteLine(($"Got a score {scoreVal} with label {predLabelVal}"));
+ }
+ }
+#else
+
// Convert IDataView object to a list.
var predictions = mlContext.Data
.CreateEnumerable(transformedTestData,
@@ -60,6 +81,7 @@ public static void Example()
.Evaluate(transformedTestData);
PrintMetrics(metrics);
+#endif
// Expected output:
// Accuracy: 0.68
diff --git a/docs/specs/AutoML Experiment API Proposal.md b/docs/specs/AutoML Experiment API Proposal.md
new file mode 100644
index 0000000000..1aa5a00d9b
--- /dev/null
+++ b/docs/specs/AutoML Experiment API Proposal.md
@@ -0,0 +1,85 @@
+## Overview
+Experiment API is a set of API build to work with `SweepablePipeline`. Its aim is to make the interaction among `Tuner`, `Search Space` and `Sweepable Pipeline` transparent to external customers.
+
+## Problem
+Suppose that you have `sweepable pipeline`, `tuner` and `searchSpace`, and you want to optimize the `sweepable pipeline` over given `searchSpace` using that `tuner`. In order to make that happen, without `Experiment API`, you would need to mannually interact with tuner and searchSpace, building mlnet training pipeline, train and evaluate model, and tracing the best model/parameter. Thus process expose too many details and would not be considered easy-to-use for users to start with.
+
+```csharp
+// this training process just expose too many details.
+var pipeline, tuner;
+
+// search space comes with pipeline.
+var searchSpace = pipeline.SearchSpace;
+
+tuner.SetSearchSpace(searchSPace);
+foreach(var parameter in tuner.Proposal())
+{
+ // construct ML.Net pipeline from parameter
+ var mlPipeline = pipeline.BuildTrainingPipeline(parameter);
+
+ // evaluate
+ var model = mlPipeline.Fit(trainData);
+ var score = model.Evaluate(testData);
+
+ // code to save best model
+ if(score > bestScore)
+ {
+ bestScore = score;
+ bestModel = model;
+ }
+
+ // update tuner with score
+ tuner.Update(parameter, score);
+}
+```
+
+## Solution: Experiment API
+
+With Experiment api, we can make `pipeline`, `tuner` and `searchspace` transparent to users so they don't have to know how those parts work with each other. What replaces them is a higher-level concept: `Experiment`. `Experiment` will take the input from users, like training time, searching strategy, train/test/validation dataset, model saving strategy... After all input is given, experiment will take care the rest of training process.
+
+```csharp
+// Experiment api.
+var pipeline, tuner;
+
+var experiment = pipeline.CreateExperiment(trainTime = 100, trainDataset = "train.csv", split = "cv", folds = 10, metric = "AUC", tuner = tuner, monitor = monitor);
+
+// or fluent-style api
+experiment = pipeline.CreateExperiment();
+
+experiment.SetTrainingTime(100)
+ .SetDataset(trainDataset = "train.csv", split = "cv", fold = 10)
+ .SetEvaluationMetric(metric = "AUC") // or a lambda function which return a score
+ .SetTuner(tuner)
+ .SetMonitor(monitor);
+
+experiment.Run()
+monitor.ShowProgress();
+
+// trial 1: score ... parameter ...
+// trial 2: score ... parameter ...
+```
+
+### default classifiers and regressors
+
+It will be useful if we provide an API that returns a combination of all available trainers with default search spaces.
+
+```csharp
+var featurizePipeline
+
+// regression
+var pipeline = featurizePipeline.Append(context.AutoML().Regressors(labelColumn = "label", useLgbm = true, useFastTree = false, ...));
+
+// binary classification
+var pipeline = featurizePipeline.Append(context.AutoML().BinaryClassification(labelColumn = "label", useLgbm = true, useFastTree = false, ...));
+
+// multi-class classification
+var pipeline = featurizePipeline.Append(context.AutoML().MultiClassification(labelColumn = "label", useLgbm = true, useFastTree = false, ...));
+
+// univariant forecasting
+var pipeline = featurizePipeline.Append(context.AutoML().Forcasting(labelColumn = "label", horizon ...));
+
+// create Experiment
+var exp = pipeline.CreateExperiment();
+...
+
+```
\ No newline at end of file
diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml
index 7362ddefe7..7f6d05980b 100644
--- a/eng/Version.Details.xml
+++ b/eng/Version.Details.xml
@@ -7,25 +7,25 @@
-
+
https://github.com/dotnet/arcade
- 569a3f07467a9ebf55b78bbf92ab10b85e597819
+ a264eb13fea14125f3ef8d4056586cd66fa55309
-
+
https://github.com/dotnet/arcade
- 569a3f07467a9ebf55b78bbf92ab10b85e597819
+ a264eb13fea14125f3ef8d4056586cd66fa55309
-
+
https://github.com/dotnet/arcade
- 569a3f07467a9ebf55b78bbf92ab10b85e597819
+ a264eb13fea14125f3ef8d4056586cd66fa55309
-
+
https://github.com/dotnet/arcade
- 569a3f07467a9ebf55b78bbf92ab10b85e597819
+ a264eb13fea14125f3ef8d4056586cd66fa55309
-
+
https://github.com/dotnet/arcade
- 569a3f07467a9ebf55b78bbf92ab10b85e597819
+ a264eb13fea14125f3ef8d4056586cd66fa55309
https://github.com/dotnet/arcade-services
@@ -39,9 +39,9 @@
https://github.com/dotnet/xharness
89cb4b1d368e0f15b4df8e02a176dd1f1c33958b
-
+
https://github.com/dotnet/arcade
- 569a3f07467a9ebf55b78bbf92ab10b85e597819
+ a264eb13fea14125f3ef8d4056586cd66fa55309
https://github.com/dotnet/roslyn
diff --git a/eng/Versions.props b/eng/Versions.props
index da4fc00545..b5ec1b8096 100644
--- a/eng/Versions.props
+++ b/eng/Versions.props
@@ -33,17 +33,23 @@
2.0.0
3.19.4
2.3.1
+ 1.7.0
3.3.0
3.9.0
- 1.0.0-beta.22103.1
- 1.0.0-beta.22103.1
+ 1.0.0-beta.22314.1
+ 1.0.0-beta.22314.1
0.4.1
1.10.0
0.0.0.12
+ 0.0.0.12
+ 2021.7.0
+ 1
+ 1
2.1.0
2.1.0
- 10.0.3
+ 13.0.1
2.1.3
+ 0.0.1
1.3.3
0.20.1
2
@@ -68,7 +74,7 @@
3.1.0
5.10.2
1.0.1-beta1.20374.2
- 7.0.0-beta.22313.1
+ 7.0.0-beta.22327.2
2.1.0
3.0.1
0.0.6-test
diff --git a/eng/common/templates/steps/send-to-helix.yml b/eng/common/templates/steps/send-to-helix.yml
index 09a223989f..3eb7e2d5f8 100644
--- a/eng/common/templates/steps/send-to-helix.yml
+++ b/eng/common/templates/steps/send-to-helix.yml
@@ -3,7 +3,7 @@ parameters:
HelixSource: 'pr/default' # required -- sources must start with pr/, official/, prodcon/, or agent/
HelixType: 'tests/default/' # required -- Helix telemetry which identifies what type of data this is; should include "test" for clarity and must end in '/'
HelixBuild: $(Build.BuildNumber) # required -- the build number Helix will use to identify this -- automatically set to the AzDO build number
- HelixTargetQueues: '' # required -- semicolon delimited list of Helix queues to test on; see https://helix.dot.net/ for a list of queues
+ HelixTargetQueues: '' # required -- semicolon-delimited list of Helix queues to test on; see https://helix.dot.net/ for a list of queues
HelixAccessToken: '' # required -- access token to make Helix API requests; should be provided by the appropriate variable group
HelixConfiguration: '' # optional -- additional property attached to a job
HelixPreCommands: '' # optional -- commands to run before Helix work item execution
@@ -12,7 +12,7 @@ parameters:
WorkItemCommand: '' # optional -- a command to execute on the payload; requires WorkItemDirectory; incompatible with XUnitProjects
WorkItemTimeout: '' # optional -- a timeout in TimeSpan.Parse-ready value (e.g. 00:02:00) for the work item command; requires WorkItemDirectory; incompatible with XUnitProjects
CorrelationPayloadDirectory: '' # optional -- a directory to zip up and send to Helix as a correlation payload
- XUnitProjects: '' # optional -- semicolon delimited list of XUnitProjects to parse and send to Helix; requires XUnitRuntimeTargetFramework, XUnitPublishTargetFramework, XUnitRunnerVersion, and IncludeDotNetCli=true
+ XUnitProjects: '' # optional -- semicolon-delimited list of XUnitProjects to parse and send to Helix; requires XUnitRuntimeTargetFramework, XUnitPublishTargetFramework, XUnitRunnerVersion, and IncludeDotNetCli=true
XUnitWorkItemTimeout: '' # optional -- the workitem timeout in seconds for all workitems created from the xUnit projects specified by XUnitProjects
XUnitPublishTargetFramework: '' # optional -- framework to use to publish your xUnit projects
XUnitRuntimeTargetFramework: '' # optional -- framework to use for the xUnit console runner
@@ -22,14 +22,14 @@ parameters:
DotNetCliVersion: '' # optional -- version of the CLI to send to Helix; based on this: https://raw.githubusercontent.com/dotnet/core/main/release-notes/releases-index.json
WaitForWorkItemCompletion: true # optional -- true will make the task wait until work items have been completed and fail the build if work items fail. False is "fire and forget."
IsExternal: false # [DEPRECATED] -- doesn't do anything, jobs are external if HelixAccessToken is empty and Creator is set
- HelixBaseUri: 'https://helix.dot.net/' # optional -- sets the Helix API base URI (allows targeting int)
+ HelixBaseUri: 'https://helix.dot.net/' # optional -- sets the Helix API base URI (allows targeting https://helix.int-dot.net )
Creator: '' # optional -- if the build is external, use this to specify who is sending the job
DisplayNamePrefix: 'Run Tests' # optional -- rename the beginning of the displayName of the steps in AzDO
condition: succeeded() # optional -- condition for step to execute; defaults to succeeded()
continueOnError: false # optional -- determines whether to continue the build if the step errors; defaults to false
steps:
- - powershell: 'powershell "$env:BUILD_SOURCESDIRECTORY\eng\common\msbuild.ps1 $env:BUILD_SOURCESDIRECTORY\eng\common\helixpublish.proj /restore /t:Test /bl:$env:BUILD_SOURCESDIRECTORY\artifacts\log\$env:BuildConfig\SendToHelix.binlog"'
+ - powershell: 'powershell "$env:BUILD_SOURCESDIRECTORY\eng\common\msbuild.ps1 $env:BUILD_SOURCESDIRECTORY\eng\common\helixpublish.proj /restore /p:TreatWarningsAsErrors=false /t:Test /bl:$env:BUILD_SOURCESDIRECTORY\artifacts\log\$env:BuildConfig\SendToHelix.binlog"'
displayName: ${{ parameters.DisplayNamePrefix }} (Windows)
env:
BuildConfig: $(_BuildConfig)
@@ -59,7 +59,7 @@ steps:
SYSTEM_ACCESSTOKEN: $(System.AccessToken)
condition: and(${{ parameters.condition }}, eq(variables['Agent.Os'], 'Windows_NT'))
continueOnError: ${{ parameters.continueOnError }}
- - script: $BUILD_SOURCESDIRECTORY/eng/common/msbuild.sh $BUILD_SOURCESDIRECTORY/eng/common/helixpublish.proj /restore /t:Test /bl:$BUILD_SOURCESDIRECTORY/artifacts/log/$BuildConfig/SendToHelix.binlog
+ - script: $BUILD_SOURCESDIRECTORY/eng/common/msbuild.sh $BUILD_SOURCESDIRECTORY/eng/common/helixpublish.proj /restore /p:TreatWarningsAsErrors=false /t:Test /bl:$BUILD_SOURCESDIRECTORY/artifacts/log/$BuildConfig/SendToHelix.binlog
displayName: ${{ parameters.DisplayNamePrefix }} (Unix)
env:
BuildConfig: $(_BuildConfig)
diff --git a/eng/common/tools.ps1 b/eng/common/tools.ps1
index 423bd962e9..395b43eebb 100644
--- a/eng/common/tools.ps1
+++ b/eng/common/tools.ps1
@@ -573,7 +573,7 @@ function InitializeBuildTool() {
ExitWithExitCode 1
}
$dotnetPath = Join-Path $dotnetRoot (GetExecutableFileName 'dotnet')
- $buildTool = @{ Path = $dotnetPath; Command = 'msbuild'; Tool = 'dotnet'; Framework = 'netcoreapp3.1' }
+ $buildTool = @{ Path = $dotnetPath; Command = 'msbuild'; Tool = 'dotnet'; Framework = 'net7.0' }
} elseif ($msbuildEngine -eq "vs") {
try {
$msbuildPath = InitializeVisualStudioMSBuild -install:$restore
diff --git a/eng/common/tools.sh b/eng/common/tools.sh
index 17f0a36580..c110d0ed41 100755
--- a/eng/common/tools.sh
+++ b/eng/common/tools.sh
@@ -312,7 +312,7 @@ function InitializeBuildTool {
# return values
_InitializeBuildTool="$_InitializeDotNetCli/dotnet"
_InitializeBuildToolCommand="msbuild"
- _InitializeBuildToolFramework="netcoreapp3.1"
+ _InitializeBuildToolFramework="net7.0"
}
# Set RestoreNoCache as a workaround for https://github.com/NuGet/Home/issues/3116
diff --git a/global.json b/global.json
index 7c093b0660..e118d70c2e 100644
--- a/global.json
+++ b/global.json
@@ -11,8 +11,8 @@
}
},
"msbuild-sdks": {
- "Microsoft.DotNet.Arcade.Sdk": "7.0.0-beta.22313.1",
- "Microsoft.DotNet.Helix.Sdk": "7.0.0-beta.22313.1",
+ "Microsoft.DotNet.Arcade.Sdk": "7.0.0-beta.22327.2",
+ "Microsoft.DotNet.Helix.Sdk": "7.0.0-beta.22327.2",
"Microsoft.Build.Traversal": "2.1.1",
"Microsoft.SourceLink.GitHub": "1.1.0-beta-20206-02",
"Microsoft.SourceLink.Common": "1.1.0-beta-20206-02"
diff --git a/src/Microsoft.Data.Analysis/ColumnArithmeticTemplate.ttinclude b/src/Microsoft.Data.Analysis/ColumnArithmeticTemplate.ttinclude
index 4c3e9f332b..bb31da6a94 100644
--- a/src/Microsoft.Data.Analysis/ColumnArithmeticTemplate.ttinclude
+++ b/src/Microsoft.Data.Analysis/ColumnArithmeticTemplate.ttinclude
@@ -150,7 +150,8 @@
new TypeConfiguration("short", unsupportedMethods: new[] {"All", "Any"}),
new TypeConfiguration("uint", classPrefix:"UInt", unsupportedMethods: new[] {"UnaryMinus", "All", "Any"}),
new TypeConfiguration("ulong", classPrefix:"ULong", unsupportedMethods: new[] {"UnaryMinus", "All", "Any"}),
- new TypeConfiguration("ushort", classPrefix:"UShort", unsupportedMethods: new[] {"UnaryMinus", "All", "Any"})
+ new TypeConfiguration("ushort", classPrefix:"UShort", unsupportedMethods: new[] {"UnaryMinus", "All", "Any"}),
+ new TypeConfiguration("DateTime", supportsBitwise: false, supportsNumeric: false, unsupportedMethods: new[] {"And", "Or", "Xor"})
};
public string GetBinaryShiftOperationReturnType(TypeConfiguration t1)
diff --git a/src/Microsoft.Data.Analysis/DataFrame.IO.cs b/src/Microsoft.Data.Analysis/DataFrame.IO.cs
index 30f395352c..4f14615b0e 100644
--- a/src/Microsoft.Data.Analysis/DataFrame.IO.cs
+++ b/src/Microsoft.Data.Analysis/DataFrame.IO.cs
@@ -450,28 +450,25 @@ public static void WriteCsv(DataFrame dataFrame, Stream csvStream,
{
if (dataFrame != null)
{
- var columnNames = dataFrame.Columns.GetColumnNames();
-
if (header)
{
- var headerColumns = string.Join(separator.ToString(), columnNames);
- csvFile.WriteLine(headerColumns);
+ WriteHeader(csvFile, dataFrame.Columns.GetColumnNames(), separator);
}
var record = new StringBuilder();
foreach (var row in dataFrame.Rows)
{
- bool firstRow = true;
+ bool firstCell = true;
foreach (var cell in row)
{
- if (!firstRow)
+ if (!firstCell)
{
record.Append(separator);
}
else
{
- firstRow = false;
+ firstCell = false;
}
Type t = cell?.GetType();
@@ -500,6 +497,18 @@ public static void WriteCsv(DataFrame dataFrame, Stream csvStream,
continue;
}
+ if (t == typeof(string))
+ {
+ bool needsQuotes = ((string)cell).IndexOf(separator) != -1 || ((string)cell).IndexOf('\n') != -1;
+ if (needsQuotes)
+ {
+ record.Append('\"');
+ record.Append(cell);
+ record.Append('\"');
+ continue;
+ }
+ }
+
record.Append(cell);
}
@@ -510,5 +519,34 @@ public static void WriteCsv(DataFrame dataFrame, Stream csvStream,
}
}
}
+ private static void WriteHeader(StreamWriter csvFile, IReadOnlyList columnNames, char separator)
+ {
+ bool firstColumn = true;
+ foreach (string name in columnNames)
+ {
+ if (!firstColumn)
+ {
+ csvFile.Write(separator);
+ }
+ else
+ {
+ firstColumn = false;
+ }
+
+ bool needsQuotes = name.IndexOf(separator) != -1 || name.IndexOf('\n') != -1;
+ if (needsQuotes)
+ {
+ csvFile.Write('\"');
+ csvFile.Write(name);
+ csvFile.Write('\"');
+ }
+ else
+ {
+ csvFile.Write(name);
+ }
+ }
+
+ csvFile.WriteLine();
+ }
}
}
diff --git a/src/Microsoft.Data.Analysis/DateTimeDataFrameColumn.cs b/src/Microsoft.Data.Analysis/DateTimeDataFrameColumn.cs
new file mode 100644
index 0000000000..2bb875f66c
--- /dev/null
+++ b/src/Microsoft.Data.Analysis/DateTimeDataFrameColumn.cs
@@ -0,0 +1,23 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace Microsoft.Data.Analysis
+{
+ public partial class DateTimeDataFrameColumn : PrimitiveDataFrameColumn
+ {
+ public DateTimeDataFrameColumn(string name, IEnumerable values) : base(name, values) { }
+
+ public DateTimeDataFrameColumn(string name, IEnumerable values) : base(name, values) { }
+
+ public DateTimeDataFrameColumn(string name, long length = 0) : base(name, length) { }
+
+ public DateTimeDataFrameColumn(string name, ReadOnlyMemory buffer, ReadOnlyMemory nullBitMap, int length = 0, int nullCount = 0) : base(name, buffer, nullBitMap, length, nullCount) { }
+
+ internal DateTimeDataFrameColumn(string name, PrimitiveColumnContainer values) : base(name, values) { }
+ }
+}
diff --git a/src/Microsoft.Data.Analysis/IDataView.Extension.cs b/src/Microsoft.Data.Analysis/IDataView.Extension.cs
index 32b97d365a..aae5c38e63 100644
--- a/src/Microsoft.Data.Analysis/IDataView.Extension.cs
+++ b/src/Microsoft.Data.Analysis/IDataView.Extension.cs
@@ -68,6 +68,10 @@ public static DataFrame ToDataFrame(this IDataView dataView, long maxRows, param
{
dataFrameColumns.Add(new BooleanDataFrameColumn(dataViewColumn.Name));
}
+ else if (type == DateTimeDataViewType.Instance)
+ {
+ dataFrameColumns.Add(new DateTimeDataFrameColumn(dataViewColumn.Name));
+ }
else if (type == NumberDataViewType.Byte)
{
dataFrameColumns.Add(new ByteDataFrameColumn(dataViewColumn.Name));
diff --git a/src/Microsoft.Data.Analysis/PrimitiveDataFrameColumn.BinaryOperationAPIs.ExplodedColumns.cs b/src/Microsoft.Data.Analysis/PrimitiveDataFrameColumn.BinaryOperationAPIs.ExplodedColumns.cs
index 51258d1d77..25f36cfdf9 100644
--- a/src/Microsoft.Data.Analysis/PrimitiveDataFrameColumn.BinaryOperationAPIs.ExplodedColumns.cs
+++ b/src/Microsoft.Data.Analysis/PrimitiveDataFrameColumn.BinaryOperationAPIs.ExplodedColumns.cs
@@ -12248,6 +12248,33 @@ public BooleanDataFrameColumn ElementwiseLessThan(UInt16DataFrameColumn column)
return ElementwiseLessThanImplementation(column);
}
}
+ public partial class DateTimeDataFrameColumn
+ {
+ public BooleanDataFrameColumn ElementwiseEquals(DateTimeDataFrameColumn column)
+ {
+ return ElementwiseEqualsImplementation(column);
+ }
+ public BooleanDataFrameColumn ElementwiseNotEquals(DateTimeDataFrameColumn column)
+ {
+ return ElementwiseNotEqualsImplementation(column);
+ }
+ public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(DateTimeDataFrameColumn column)
+ {
+ return ElementwiseGreaterThanOrEqualImplementation(column);
+ }
+ public BooleanDataFrameColumn ElementwiseLessThanOrEqual(DateTimeDataFrameColumn column)
+ {
+ return ElementwiseLessThanOrEqualImplementation(column);
+ }
+ public BooleanDataFrameColumn ElementwiseGreaterThan(DateTimeDataFrameColumn column)
+ {
+ return ElementwiseGreaterThanImplementation(column);
+ }
+ public BooleanDataFrameColumn ElementwiseLessThan(DateTimeDataFrameColumn column)
+ {
+ return ElementwiseLessThanImplementation(column);
+ }
+ }
public partial class BooleanDataFrameColumn
{
public BooleanDataFrameColumn ElementwiseEquals(bool value)
@@ -15692,6 +15719,33 @@ public BooleanDataFrameColumn ElementwiseLessThan(ushort value)
return ElementwiseLessThanImplementation(value);
}
}
+ public partial class DateTimeDataFrameColumn
+ {
+ public BooleanDataFrameColumn ElementwiseEquals(DateTime value)
+ {
+ return ElementwiseEqualsImplementation(value);
+ }
+ public BooleanDataFrameColumn ElementwiseNotEquals(DateTime value)
+ {
+ return ElementwiseNotEqualsImplementation(value);
+ }
+ public BooleanDataFrameColumn ElementwiseGreaterThanOrEqual(DateTime value)
+ {
+ return ElementwiseGreaterThanOrEqualImplementation(value);
+ }
+ public BooleanDataFrameColumn ElementwiseLessThanOrEqual(DateTime value)
+ {
+ return ElementwiseLessThanOrEqualImplementation(value);
+ }
+ public BooleanDataFrameColumn ElementwiseGreaterThan(DateTime value)
+ {
+ return ElementwiseGreaterThanImplementation(value);
+ }
+ public BooleanDataFrameColumn ElementwiseLessThan(DateTime value)
+ {
+ return ElementwiseLessThanImplementation(value);
+ }
+ }
public partial class ByteDataFrameColumn
{
diff --git a/src/Microsoft.Data.Analysis/PrimitiveDataFrameColumn.BinaryOperationImplementations.Exploded.cs b/src/Microsoft.Data.Analysis/PrimitiveDataFrameColumn.BinaryOperationImplementations.Exploded.cs
index 9dd963a338..af3ac7e5ee 100644
--- a/src/Microsoft.Data.Analysis/PrimitiveDataFrameColumn.BinaryOperationImplementations.Exploded.cs
+++ b/src/Microsoft.Data.Analysis/PrimitiveDataFrameColumn.BinaryOperationImplementations.Exploded.cs
@@ -1204,6 +1204,15 @@ internal BooleanDataFrameColumn ElementwiseEqualsImplementation(UInt16DataFrameC
return newColumn;
}
}
+ public partial class DateTimeDataFrameColumn
+ {
+ internal BooleanDataFrameColumn ElementwiseEqualsImplementation(DateTimeDataFrameColumn column)
+ {
+ BooleanDataFrameColumn newColumn = CloneAsBooleanColumn();
+ ColumnContainer.ElementwiseEquals(column.ColumnContainer, newColumn.ColumnContainer);
+ return newColumn;
+ }
+ }
public partial class BooleanDataFrameColumn
{
internal BooleanDataFrameColumn ElementwiseEqualsImplementation(bool value)
@@ -1312,6 +1321,15 @@ internal BooleanDataFrameColumn ElementwiseEqualsImplementation(ushort value)
return newColumn;
}
}
+ public partial class DateTimeDataFrameColumn
+ {
+ internal BooleanDataFrameColumn ElementwiseEqualsImplementation(DateTime value)
+ {
+ BooleanDataFrameColumn newColumn = CloneAsBooleanColumn();
+ ColumnContainer.ElementwiseEquals(value, newColumn.ColumnContainer);
+ return newColumn;
+ }
+ }
public partial class BooleanDataFrameColumn
{
internal BooleanDataFrameColumn ElementwiseNotEqualsImplementation(BooleanDataFrameColumn column)
@@ -1420,6 +1438,15 @@ internal BooleanDataFrameColumn ElementwiseNotEqualsImplementation(UInt16DataFra
return newColumn;
}
}
+ public partial class DateTimeDataFrameColumn
+ {
+ internal BooleanDataFrameColumn ElementwiseNotEqualsImplementation(DateTimeDataFrameColumn column)
+ {
+ BooleanDataFrameColumn newColumn = CloneAsBooleanColumn();
+ ColumnContainer.ElementwiseNotEquals(column.ColumnContainer, newColumn.ColumnContainer);
+ return newColumn;
+ }
+ }
public partial class BooleanDataFrameColumn
{
internal BooleanDataFrameColumn ElementwiseNotEqualsImplementation(bool value)
@@ -1528,6 +1555,15 @@ internal BooleanDataFrameColumn ElementwiseNotEqualsImplementation(ushort value)
return newColumn;
}
}
+ public partial class DateTimeDataFrameColumn
+ {
+ internal BooleanDataFrameColumn ElementwiseNotEqualsImplementation(DateTime value)
+ {
+ BooleanDataFrameColumn newColumn = CloneAsBooleanColumn();
+ ColumnContainer.ElementwiseNotEquals(value, newColumn.ColumnContainer);
+ return newColumn;
+ }
+ }
public partial class BooleanDataFrameColumn
{
internal BooleanDataFrameColumn ElementwiseGreaterThanOrEqualImplementation(BooleanDataFrameColumn column)
@@ -1636,6 +1672,15 @@ internal BooleanDataFrameColumn ElementwiseGreaterThanOrEqualImplementation(UInt
return newColumn;
}
}
+ public partial class DateTimeDataFrameColumn
+ {
+ internal BooleanDataFrameColumn ElementwiseGreaterThanOrEqualImplementation(DateTimeDataFrameColumn column)
+ {
+ BooleanDataFrameColumn newColumn = CloneAsBooleanColumn();
+ ColumnContainer.ElementwiseGreaterThanOrEqual(column.ColumnContainer, newColumn.ColumnContainer);
+ return newColumn;
+ }
+ }
public partial class BooleanDataFrameColumn
{
internal BooleanDataFrameColumn ElementwiseGreaterThanOrEqualImplementation(bool value)
@@ -1744,6 +1789,15 @@ internal BooleanDataFrameColumn ElementwiseGreaterThanOrEqualImplementation(usho
return newColumn;
}
}
+ public partial class DateTimeDataFrameColumn
+ {
+ internal BooleanDataFrameColumn ElementwiseGreaterThanOrEqualImplementation(DateTime value)
+ {
+ BooleanDataFrameColumn newColumn = CloneAsBooleanColumn();
+ ColumnContainer.ElementwiseGreaterThanOrEqual(value, newColumn.ColumnContainer);
+ return newColumn;
+ }
+ }
public partial class BooleanDataFrameColumn
{
internal BooleanDataFrameColumn ElementwiseLessThanOrEqualImplementation(BooleanDataFrameColumn column)
@@ -1852,6 +1906,15 @@ internal BooleanDataFrameColumn ElementwiseLessThanOrEqualImplementation(UInt16D
return newColumn;
}
}
+ public partial class DateTimeDataFrameColumn
+ {
+ internal BooleanDataFrameColumn ElementwiseLessThanOrEqualImplementation(DateTimeDataFrameColumn column)
+ {
+ BooleanDataFrameColumn newColumn = CloneAsBooleanColumn();
+ ColumnContainer.ElementwiseLessThanOrEqual(column.ColumnContainer, newColumn.ColumnContainer);
+ return newColumn;
+ }
+ }
public partial class BooleanDataFrameColumn
{
internal BooleanDataFrameColumn ElementwiseLessThanOrEqualImplementation(bool value)
@@ -1960,6 +2023,15 @@ internal BooleanDataFrameColumn ElementwiseLessThanOrEqualImplementation(ushort
return newColumn;
}
}
+ public partial class DateTimeDataFrameColumn
+ {
+ internal BooleanDataFrameColumn ElementwiseLessThanOrEqualImplementation(DateTime value)
+ {
+ BooleanDataFrameColumn newColumn = CloneAsBooleanColumn();
+ ColumnContainer.ElementwiseLessThanOrEqual(value, newColumn.ColumnContainer);
+ return newColumn;
+ }
+ }
public partial class BooleanDataFrameColumn
{
internal BooleanDataFrameColumn ElementwiseGreaterThanImplementation(BooleanDataFrameColumn column)
@@ -2068,6 +2140,15 @@ internal BooleanDataFrameColumn ElementwiseGreaterThanImplementation(UInt16DataF
return newColumn;
}
}
+ public partial class DateTimeDataFrameColumn
+ {
+ internal BooleanDataFrameColumn ElementwiseGreaterThanImplementation(DateTimeDataFrameColumn column)
+ {
+ BooleanDataFrameColumn newColumn = CloneAsBooleanColumn();
+ ColumnContainer.ElementwiseGreaterThan(column.ColumnContainer, newColumn.ColumnContainer);
+ return newColumn;
+ }
+ }
public partial class BooleanDataFrameColumn
{
internal BooleanDataFrameColumn ElementwiseGreaterThanImplementation(bool value)
@@ -2176,6 +2257,15 @@ internal BooleanDataFrameColumn ElementwiseGreaterThanImplementation(ushort valu
return newColumn;
}
}
+ public partial class DateTimeDataFrameColumn
+ {
+ internal BooleanDataFrameColumn ElementwiseGreaterThanImplementation(DateTime value)
+ {
+ BooleanDataFrameColumn newColumn = CloneAsBooleanColumn();
+ ColumnContainer.ElementwiseGreaterThan(value, newColumn.ColumnContainer);
+ return newColumn;
+ }
+ }
public partial class BooleanDataFrameColumn
{
internal BooleanDataFrameColumn ElementwiseLessThanImplementation(BooleanDataFrameColumn column)
@@ -2284,6 +2374,15 @@ internal BooleanDataFrameColumn ElementwiseLessThanImplementation(UInt16DataFram
return newColumn;
}
}
+ public partial class DateTimeDataFrameColumn
+ {
+ internal BooleanDataFrameColumn ElementwiseLessThanImplementation(DateTimeDataFrameColumn column)
+ {
+ BooleanDataFrameColumn newColumn = CloneAsBooleanColumn();
+ ColumnContainer.ElementwiseLessThan(column.ColumnContainer, newColumn.ColumnContainer);
+ return newColumn;
+ }
+ }
public partial class BooleanDataFrameColumn
{
internal BooleanDataFrameColumn ElementwiseLessThanImplementation(bool value)
@@ -2392,4 +2491,13 @@ internal BooleanDataFrameColumn ElementwiseLessThanImplementation(ushort value)
return newColumn;
}
}
+ public partial class DateTimeDataFrameColumn
+ {
+ internal BooleanDataFrameColumn ElementwiseLessThanImplementation(DateTime value)
+ {
+ BooleanDataFrameColumn newColumn = CloneAsBooleanColumn();
+ ColumnContainer.ElementwiseLessThan(value, newColumn.ColumnContainer);
+ return newColumn;
+ }
+ }
}
diff --git a/src/Microsoft.Data.Analysis/PrimitiveDataFrameColumn.BinaryOperations.Combinations.tt b/src/Microsoft.Data.Analysis/PrimitiveDataFrameColumn.BinaryOperations.Combinations.tt
index 33f0a0ad72..b1ea4e40bb 100644
--- a/src/Microsoft.Data.Analysis/PrimitiveDataFrameColumn.BinaryOperations.Combinations.tt
+++ b/src/Microsoft.Data.Analysis/PrimitiveDataFrameColumn.BinaryOperations.Combinations.tt
@@ -86,10 +86,15 @@ public static class ComparisonOperationCombinations
{
continue;
}
+ // Bool should only compare with bool, DateTime only with DateTime
if (type.TypeName == "bool" && innerType.TypeName != "bool")
{
continue;
}
+ if (type.TypeName == "DateTime" && innerType.TypeName != "DateTime")
+ {
+ continue;
+ }
if (type.SupportsNumeric != innerType.SupportsNumeric)
{
continue;
diff --git a/src/Microsoft.Data.Analysis/PrimitiveDataFrameColumn.BinaryOperations.Combinations.ttinclude b/src/Microsoft.Data.Analysis/PrimitiveDataFrameColumn.BinaryOperations.Combinations.ttinclude
index 23a88d1f12..946e0a7e12 100644
--- a/src/Microsoft.Data.Analysis/PrimitiveDataFrameColumn.BinaryOperations.Combinations.ttinclude
+++ b/src/Microsoft.Data.Analysis/PrimitiveDataFrameColumn.BinaryOperations.Combinations.ttinclude
@@ -266,6 +266,7 @@ public static class ComparisonOperationCombinations
new TypeCombination("ushort", "uint", "bool"),
new TypeCombination("ushort", "ulong", "bool"),
new TypeCombination("ushort", "ushort", "bool"),
+ new TypeCombination("DateTime", "DateTime", "bool"),
};
}
#>
diff --git a/src/Microsoft.Data.Analysis/PrimitiveDataFrameColumn.BinaryOperations.cs b/src/Microsoft.Data.Analysis/PrimitiveDataFrameColumn.BinaryOperations.cs
index 6a77e49ad4..fc265060ae 100644
--- a/src/Microsoft.Data.Analysis/PrimitiveDataFrameColumn.BinaryOperations.cs
+++ b/src/Microsoft.Data.Analysis/PrimitiveDataFrameColumn.BinaryOperations.cs
@@ -45,6 +45,8 @@ public override DataFrameColumn Add(DataFrameColumn column, bool inPlace = false
return AddImplementation(column as PrimitiveDataFrameColumn, inPlace);
case PrimitiveDataFrameColumn ushortColumn:
return AddImplementation(column as PrimitiveDataFrameColumn, inPlace);
+ case PrimitiveDataFrameColumn DateTimeColumn:
+ return AddImplementation(column as PrimitiveDataFrameColumn, inPlace);
default:
throw new NotSupportedException();
}
@@ -90,6 +92,8 @@ public override DataFrameColumn Subtract(DataFrameColumn column, bool inPlace =
return SubtractImplementation(column as PrimitiveDataFrameColumn, inPlace);
case PrimitiveDataFrameColumn ushortColumn:
return SubtractImplementation(column as PrimitiveDataFrameColumn, inPlace);
+ case PrimitiveDataFrameColumn DateTimeColumn:
+ return SubtractImplementation(column as PrimitiveDataFrameColumn, inPlace);
default:
throw new NotSupportedException();
}
@@ -135,6 +139,8 @@ public override DataFrameColumn Multiply(DataFrameColumn column, bool inPlace =
return MultiplyImplementation(column as PrimitiveDataFrameColumn, inPlace);
case PrimitiveDataFrameColumn ushortColumn:
return MultiplyImplementation(column as PrimitiveDataFrameColumn, inPlace);
+ case PrimitiveDataFrameColumn DateTimeColumn:
+ return MultiplyImplementation(column as PrimitiveDataFrameColumn, inPlace);
default:
throw new NotSupportedException();
}
@@ -180,6 +186,8 @@ public override DataFrameColumn Divide(DataFrameColumn column, bool inPlace = fa
return DivideImplementation(column as PrimitiveDataFrameColumn, inPlace);
case PrimitiveDataFrameColumn ushortColumn:
return DivideImplementation(column as PrimitiveDataFrameColumn, inPlace);
+ case PrimitiveDataFrameColumn DateTimeColumn:
+ return DivideImplementation(column as PrimitiveDataFrameColumn, inPlace);
default:
throw new NotSupportedException();
}
@@ -225,6 +233,8 @@ public override DataFrameColumn Modulo(DataFrameColumn column, bool inPlace = fa
return ModuloImplementation(column as PrimitiveDataFrameColumn, inPlace);
case PrimitiveDataFrameColumn ushortColumn:
return ModuloImplementation(column as PrimitiveDataFrameColumn, inPlace);
+ case PrimitiveDataFrameColumn DateTimeColumn:
+ return ModuloImplementation(column as PrimitiveDataFrameColumn, inPlace);
default:
throw new NotSupportedException();
}
@@ -270,6 +280,8 @@ public override DataFrameColumn And(DataFrameColumn column, bool inPlace = false
return AndImplementation(column as PrimitiveDataFrameColumn, inPlace);
case PrimitiveDataFrameColumn ushortColumn:
return AndImplementation(column as PrimitiveDataFrameColumn, inPlace);
+ case PrimitiveDataFrameColumn DateTimeColumn:
+ return AndImplementation(column as PrimitiveDataFrameColumn, inPlace);
default:
throw new NotSupportedException();
}
@@ -310,6 +322,8 @@ public override DataFrameColumn Or(DataFrameColumn column, bool inPlace = false)
return OrImplementation(column as PrimitiveDataFrameColumn, inPlace);
case PrimitiveDataFrameColumn ushortColumn:
return OrImplementation(column as PrimitiveDataFrameColumn, inPlace);
+ case PrimitiveDataFrameColumn DateTimeColumn:
+ return OrImplementation(column as PrimitiveDataFrameColumn, inPlace);
default:
throw new NotSupportedException();
}
@@ -350,6 +364,8 @@ public override DataFrameColumn Xor(DataFrameColumn column, bool inPlace = false
return XorImplementation(column as PrimitiveDataFrameColumn, inPlace);
case PrimitiveDataFrameColumn ushortColumn:
return XorImplementation(column as PrimitiveDataFrameColumn, inPlace);
+ case PrimitiveDataFrameColumn DateTimeColumn:
+ return XorImplementation(column as PrimitiveDataFrameColumn, inPlace);
default:
throw new NotSupportedException();
}
@@ -400,6 +416,8 @@ public override PrimitiveDataFrameColumn ElementwiseEquals(DataFrameColumn
return ElementwiseEqualsImplementation(column as PrimitiveDataFrameColumn);
case PrimitiveDataFrameColumn ushortColumn:
return ElementwiseEqualsImplementation(column as PrimitiveDataFrameColumn);
+ case PrimitiveDataFrameColumn DateTimeColumn:
+ return ElementwiseEqualsImplementation(column as PrimitiveDataFrameColumn);
default:
throw new NotSupportedException();
}
@@ -445,6 +463,8 @@ public override PrimitiveDataFrameColumn ElementwiseNotEquals(DataFrameCol
return ElementwiseNotEqualsImplementation(column as PrimitiveDataFrameColumn);
case PrimitiveDataFrameColumn ushortColumn:
return ElementwiseNotEqualsImplementation(column as PrimitiveDataFrameColumn);
+ case PrimitiveDataFrameColumn DateTimeColumn:
+ return ElementwiseNotEqualsImplementation(column as PrimitiveDataFrameColumn);
default:
throw new NotSupportedException();
}
@@ -490,6 +510,8 @@ public override PrimitiveDataFrameColumn ElementwiseGreaterThanOrEqual(Dat
return ElementwiseGreaterThanOrEqualImplementation(column as PrimitiveDataFrameColumn);
case PrimitiveDataFrameColumn ushortColumn:
return ElementwiseGreaterThanOrEqualImplementation(column as PrimitiveDataFrameColumn);
+ case PrimitiveDataFrameColumn DateTimeColumn:
+ return ElementwiseGreaterThanOrEqualImplementation(column as PrimitiveDataFrameColumn);
default:
throw new NotSupportedException();
}
@@ -535,6 +557,8 @@ public override PrimitiveDataFrameColumn ElementwiseLessThanOrEqual(DataFr
return ElementwiseLessThanOrEqualImplementation(column as PrimitiveDataFrameColumn);
case PrimitiveDataFrameColumn ushortColumn:
return ElementwiseLessThanOrEqualImplementation(column as PrimitiveDataFrameColumn);
+ case PrimitiveDataFrameColumn DateTimeColumn:
+ return ElementwiseLessThanOrEqualImplementation(column as PrimitiveDataFrameColumn);
default:
throw new NotSupportedException();
}
@@ -580,6 +604,8 @@ public override PrimitiveDataFrameColumn ElementwiseGreaterThan(DataFrameC
return ElementwiseGreaterThanImplementation(column as PrimitiveDataFrameColumn);
case PrimitiveDataFrameColumn ushortColumn:
return ElementwiseGreaterThanImplementation(column as PrimitiveDataFrameColumn);
+ case PrimitiveDataFrameColumn DateTimeColumn:
+ return ElementwiseGreaterThanImplementation(column as PrimitiveDataFrameColumn);
default:
throw new NotSupportedException();
}
@@ -625,6 +651,8 @@ public override PrimitiveDataFrameColumn ElementwiseLessThan(DataFrameColu
return ElementwiseLessThanImplementation(column as PrimitiveDataFrameColumn);
case PrimitiveDataFrameColumn ushortColumn:
return ElementwiseLessThanImplementation(column as PrimitiveDataFrameColumn);
+ case PrimitiveDataFrameColumn DateTimeColumn:
+ return ElementwiseLessThanImplementation(column as PrimitiveDataFrameColumn);
default:
throw new NotSupportedException();
}
@@ -674,6 +702,8 @@ internal DataFrameColumn AddImplementation(PrimitiveDataFrameColumn column
decimalColumn._columnContainer.Add(column.CloneAsDecimalColumn()._columnContainer);
return decimalColumn;
}
+ case Type DateTimeType when DateTimeType == typeof(DateTime):
+ throw new NotSupportedException();
case Type byteType when byteType == typeof(byte):
case Type charType when charType == typeof(char):
case Type doubleType when doubleType == typeof(double):
@@ -749,6 +779,8 @@ internal DataFrameColumn AddImplementation(U value, bool inPlace)
decimalColumn._columnContainer.Add(DecimalConverter.Instance.GetDecimal(value));
return decimalColumn;
}
+ case Type DateTimeType when DateTimeType == typeof(DateTime):
+ throw new NotSupportedException();
case Type byteType when byteType == typeof(byte):
case Type charType when charType == typeof(char):
case Type doubleType when doubleType == typeof(double):
@@ -829,6 +861,8 @@ internal DataFrameColumn SubtractImplementation(PrimitiveDataFrameColumn c
decimalColumn._columnContainer.Subtract(column.CloneAsDecimalColumn()._columnContainer);
return decimalColumn;
}
+ case Type DateTimeType when DateTimeType == typeof(DateTime):
+ throw new NotSupportedException();
case Type byteType when byteType == typeof(byte):
case Type charType when charType == typeof(char):
case Type doubleType when doubleType == typeof(double):
@@ -904,6 +938,8 @@ internal DataFrameColumn SubtractImplementation(U value, bool inPlace)
decimalColumn._columnContainer.Subtract(DecimalConverter.Instance.GetDecimal(value));
return decimalColumn;
}
+ case Type DateTimeType when DateTimeType == typeof(DateTime):
+ throw new NotSupportedException();
case Type byteType when byteType == typeof(byte):
case Type charType when charType == typeof(char):
case Type doubleType when doubleType == typeof(double):
@@ -984,6 +1020,8 @@ internal DataFrameColumn MultiplyImplementation(PrimitiveDataFrameColumn c
decimalColumn._columnContainer.Multiply(column.CloneAsDecimalColumn()._columnContainer);
return decimalColumn;
}
+ case Type DateTimeType when DateTimeType == typeof(DateTime):
+ throw new NotSupportedException();
case Type byteType when byteType == typeof(byte):
case Type charType when charType == typeof(char):
case Type doubleType when doubleType == typeof(double):
@@ -1059,6 +1097,8 @@ internal DataFrameColumn MultiplyImplementation(U value, bool inPlace)
decimalColumn._columnContainer.Multiply(DecimalConverter.Instance.GetDecimal(value));
return decimalColumn;
}
+ case Type DateTimeType when DateTimeType == typeof(DateTime):
+ throw new NotSupportedException();
case Type byteType when byteType == typeof(byte):
case Type charType when charType == typeof(char):
case Type doubleType when doubleType == typeof(double):
@@ -1139,6 +1179,8 @@ internal DataFrameColumn DivideImplementation(PrimitiveDataFrameColumn col
decimalColumn._columnContainer.Divide(column.CloneAsDecimalColumn()._columnContainer);
return decimalColumn;
}
+ case Type DateTimeType when DateTimeType == typeof(DateTime):
+ throw new NotSupportedException();
case Type byteType when byteType == typeof(byte):
case Type charType when charType == typeof(char):
case Type doubleType when doubleType == typeof(double):
@@ -1214,6 +1256,8 @@ internal DataFrameColumn DivideImplementation(U value, bool inPlace)
decimalColumn._columnContainer.Divide(DecimalConverter.Instance.GetDecimal(value));
return decimalColumn;
}
+ case Type DateTimeType when DateTimeType == typeof(DateTime):
+ throw new NotSupportedException();
case Type byteType when byteType == typeof(byte):
case Type charType when charType == typeof(char):
case Type doubleType when doubleType == typeof(double):
@@ -1294,6 +1338,8 @@ internal DataFrameColumn ModuloImplementation(PrimitiveDataFrameColumn col
decimalColumn._columnContainer.Modulo(column.CloneAsDecimalColumn()._columnContainer);
return decimalColumn;
}
+ case Type DateTimeType when DateTimeType == typeof(DateTime):
+ throw new NotSupportedException();
case Type byteType when byteType == typeof(byte):
case Type charType when charType == typeof(char):
case Type doubleType when doubleType == typeof(double):
@@ -1369,6 +1415,8 @@ internal DataFrameColumn ModuloImplementation(U value, bool inPlace)
decimalColumn._columnContainer.Modulo(DecimalConverter.Instance.GetDecimal(value));
return decimalColumn;
}
+ case Type DateTimeType when DateTimeType == typeof(DateTime):
+ throw new NotSupportedException();
case Type byteType when byteType == typeof(byte):
case Type charType when charType == typeof(char):
case Type doubleType when doubleType == typeof(double):
@@ -1445,6 +1493,7 @@ internal DataFrameColumn AndImplementation(PrimitiveDataFrameColumn column
case Type uintType when uintType == typeof(uint):
case Type ulongType when ulongType == typeof(ulong):
case Type ushortType when ushortType == typeof(ushort):
+ case Type DateTimeType when DateTimeType == typeof(DateTime):
default:
throw new NotSupportedException();
}
@@ -1474,6 +1523,7 @@ internal PrimitiveDataFrameColumn AndImplementation(U value, bool inPla
case Type uintType when uintType == typeof(uint):
case Type ulongType when ulongType == typeof(ulong):
case Type ushortType when ushortType == typeof(ushort):
+ case Type DateTimeType when DateTimeType == typeof(DateTime):
default:
throw new NotSupportedException();
}
@@ -1508,6 +1558,7 @@ internal DataFrameColumn OrImplementation(PrimitiveDataFrameColumn column,
case Type uintType when uintType == typeof(uint):
case Type ulongType when ulongType == typeof(ulong):
case Type ushortType when ushortType == typeof(ushort):
+ case Type DateTimeType when DateTimeType == typeof(DateTime):
default:
throw new NotSupportedException();
}
@@ -1537,6 +1588,7 @@ internal PrimitiveDataFrameColumn OrImplementation(U value, bool inPlac
case Type uintType when uintType == typeof(uint):
case Type ulongType when ulongType == typeof(ulong):
case Type ushortType when ushortType == typeof(ushort):
+ case Type DateTimeType when DateTimeType == typeof(DateTime):
default:
throw new NotSupportedException();
}
@@ -1571,6 +1623,7 @@ internal DataFrameColumn XorImplementation(PrimitiveDataFrameColumn column
case Type uintType when uintType == typeof(uint):
case Type ulongType when ulongType == typeof(ulong):
case Type ushortType when ushortType == typeof(ushort):
+ case Type DateTimeType when DateTimeType == typeof(DateTime):
default:
throw new NotSupportedException();
}
@@ -1600,6 +1653,7 @@ internal PrimitiveDataFrameColumn XorImplementation(U value, bool inPla
case Type uintType when uintType == typeof(uint):
case Type ulongType when ulongType == typeof(ulong):
case Type ushortType when ushortType == typeof(ushort):
+ case Type DateTimeType when DateTimeType == typeof(DateTime):
default:
throw new NotSupportedException();
}
@@ -1661,6 +1715,8 @@ internal DataFrameColumn LeftShiftImplementation(int value, bool inPlace)
PrimitiveDataFrameColumn newushortColumn = inPlace ? ushortColumn : ushortColumn.Clone();
newushortColumn._columnContainer.LeftShift(value);
return newushortColumn;
+ case Type DateTimeType when DateTimeType == typeof(DateTime):
+ throw new NotSupportedException();
default:
throw new NotSupportedException();
}
@@ -1722,6 +1778,8 @@ internal DataFrameColumn RightShiftImplementation(int value, bool inPlace)
PrimitiveDataFrameColumn newushortColumn = inPlace ? ushortColumn : ushortColumn.Clone();
newushortColumn._columnContainer.RightShift(value);
return newushortColumn;
+ case Type DateTimeType when DateTimeType == typeof(DateTime):
+ throw new NotSupportedException();
default:
throw new NotSupportedException();
}
@@ -1740,9 +1798,9 @@ internal PrimitiveDataFrameColumn ElementwiseEqualsImplementation(Primi
{
throw new NotSupportedException();
}
- PrimitiveDataFrameColumn retColumn = CloneAsBooleanColumn();
- (this as PrimitiveDataFrameColumn)._columnContainer.ElementwiseEquals(column._columnContainer, retColumn._columnContainer);
- return retColumn;
+ PrimitiveDataFrameColumn retboolColumn = CloneAsBooleanColumn();
+ (this as PrimitiveDataFrameColumn)._columnContainer.ElementwiseEquals(column._columnContainer, retboolColumn._columnContainer);
+ return retboolColumn;
case Type decimalType when decimalType == typeof(decimal):
if (typeof(U) == typeof(bool))
{
@@ -1763,6 +1821,14 @@ internal PrimitiveDataFrameColumn ElementwiseEqualsImplementation(Primi
decimalColumn._columnContainer.ElementwiseEquals(column.CloneAsDecimalColumn()._columnContainer, newColumn._columnContainer);
return newColumn;
}
+ case Type DateTimeType when DateTimeType == typeof(DateTime):
+ if (typeof(U) != typeof(DateTime))
+ {
+ throw new NotSupportedException();
+ }
+ PrimitiveDataFrameColumn retDateTimeColumn = CloneAsBooleanColumn();
+ (this as PrimitiveDataFrameColumn)._columnContainer.ElementwiseEquals(column._columnContainer, retDateTimeColumn._columnContainer);
+ return retDateTimeColumn;
case Type byteType when byteType == typeof(byte):
case Type charType when charType == typeof(char):
case Type doubleType when doubleType == typeof(double):
@@ -1816,9 +1882,9 @@ internal PrimitiveDataFrameColumn ElementwiseEqualsImplementation(U val
{
throw new NotSupportedException();
}
- PrimitiveDataFrameColumn retColumn = CloneAsBooleanColumn();
- (this as PrimitiveDataFrameColumn)._columnContainer.ElementwiseEquals(Unsafe.As(ref value), retColumn._columnContainer);
- return retColumn;
+ PrimitiveDataFrameColumn retboolColumn = CloneAsBooleanColumn();
+ (this as PrimitiveDataFrameColumn)._columnContainer.ElementwiseEquals(Unsafe.As(ref value), retboolColumn._columnContainer);
+ return retboolColumn;
case Type decimalType when decimalType == typeof(decimal):
if (typeof(U) == typeof(bool))
{
@@ -1839,6 +1905,14 @@ internal PrimitiveDataFrameColumn ElementwiseEqualsImplementation(U val
decimalColumn._columnContainer.ElementwiseEquals(DecimalConverter.Instance.GetDecimal(value), newColumn._columnContainer);
return newColumn;
}
+ case Type DateTimeType when DateTimeType == typeof(DateTime):
+ if (typeof(U) != typeof(DateTime))
+ {
+ throw new NotSupportedException();
+ }
+ PrimitiveDataFrameColumn retDateTimeColumn = CloneAsBooleanColumn();
+ (this as PrimitiveDataFrameColumn)._columnContainer.ElementwiseEquals(Unsafe.As(ref value), retDateTimeColumn._columnContainer);
+ return retDateTimeColumn;
case Type byteType when byteType == typeof(byte):
case Type charType when charType == typeof(char):
case Type doubleType when doubleType == typeof(double):
@@ -1897,9 +1971,9 @@ internal PrimitiveDataFrameColumn ElementwiseNotEqualsImplementation(Pr
{
throw new NotSupportedException();
}
- PrimitiveDataFrameColumn retColumn = CloneAsBooleanColumn();
- (this as PrimitiveDataFrameColumn)._columnContainer.ElementwiseNotEquals(column._columnContainer, retColumn._columnContainer);
- return retColumn;
+ PrimitiveDataFrameColumn retboolColumn = CloneAsBooleanColumn();
+ (this as PrimitiveDataFrameColumn)._columnContainer.ElementwiseNotEquals(column._columnContainer, retboolColumn._columnContainer);
+ return retboolColumn;
case Type decimalType when decimalType == typeof(decimal):
if (typeof(U) == typeof(bool))
{
@@ -1920,6 +1994,14 @@ internal PrimitiveDataFrameColumn ElementwiseNotEqualsImplementation(Pr
decimalColumn._columnContainer.ElementwiseNotEquals(column.CloneAsDecimalColumn()._columnContainer, newColumn._columnContainer);
return newColumn;
}
+ case Type DateTimeType when DateTimeType == typeof(DateTime):
+ if (typeof(U) != typeof(DateTime))
+ {
+ throw new NotSupportedException();
+ }
+ PrimitiveDataFrameColumn retDateTimeColumn = CloneAsBooleanColumn();
+ (this as PrimitiveDataFrameColumn)._columnContainer.ElementwiseNotEquals(column._columnContainer, retDateTimeColumn._columnContainer);
+ return retDateTimeColumn;
case Type byteType when byteType == typeof(byte):
case Type charType when charType == typeof(char):
case Type doubleType when doubleType == typeof(double):
@@ -1973,9 +2055,9 @@ internal PrimitiveDataFrameColumn ElementwiseNotEqualsImplementation(U
{
throw new NotSupportedException();
}
- PrimitiveDataFrameColumn retColumn = CloneAsBooleanColumn();
- (this as PrimitiveDataFrameColumn)._columnContainer.ElementwiseNotEquals(Unsafe.As(ref value), retColumn._columnContainer);
- return retColumn;
+ PrimitiveDataFrameColumn retboolColumn = CloneAsBooleanColumn();
+ (this as PrimitiveDataFrameColumn)._columnContainer.ElementwiseNotEquals(Unsafe.As(ref value), retboolColumn._columnContainer);
+ return retboolColumn;
case Type decimalType when decimalType == typeof(decimal):
if (typeof(U) == typeof(bool))
{
@@ -1996,6 +2078,14 @@ internal PrimitiveDataFrameColumn ElementwiseNotEqualsImplementation(U
decimalColumn._columnContainer.ElementwiseNotEquals(DecimalConverter.Instance.GetDecimal(value), newColumn._columnContainer);
return newColumn;
}
+ case Type DateTimeType when DateTimeType == typeof(DateTime):
+ if (typeof(U) != typeof(DateTime))
+ {
+ throw new NotSupportedException();
+ }
+ PrimitiveDataFrameColumn retDateTimeColumn = CloneAsBooleanColumn();
+ (this as PrimitiveDataFrameColumn)._columnContainer.ElementwiseNotEquals(Unsafe.As(ref value), retDateTimeColumn._columnContainer);
+ return retDateTimeColumn;
case Type byteType when byteType == typeof(byte):
case Type charType when charType == typeof(char):
case Type doubleType when doubleType == typeof(double):
@@ -2071,6 +2161,8 @@ internal PrimitiveDataFrameColumn ElementwiseGreaterThanOrEqualImplementat
decimalColumn._columnContainer.ElementwiseGreaterThanOrEqual(column.CloneAsDecimalColumn()._columnContainer, newColumn._columnContainer);
return newColumn;
}
+ case Type DateTimeType when DateTimeType == typeof(DateTime):
+ throw new NotSupportedException();
case Type byteType when byteType == typeof(byte):
case Type charType when charType == typeof(char):
case Type doubleType when doubleType == typeof(double):
@@ -2141,6 +2233,8 @@ internal PrimitiveDataFrameColumn ElementwiseGreaterThanOrEqualImplementat
decimalColumn._columnContainer.ElementwiseGreaterThanOrEqual(DecimalConverter.Instance.GetDecimal(value), newColumn._columnContainer);
return newColumn;
}
+ case Type DateTimeType when DateTimeType == typeof(DateTime):
+ throw new NotSupportedException();
case Type byteType when byteType == typeof(byte):
case Type charType when charType == typeof(char):
case Type doubleType when doubleType == typeof(double):
@@ -2216,6 +2310,8 @@ internal PrimitiveDataFrameColumn ElementwiseLessThanOrEqualImplementation
decimalColumn._columnContainer.ElementwiseLessThanOrEqual(column.CloneAsDecimalColumn()._columnContainer, newColumn._columnContainer);
return newColumn;
}
+ case Type DateTimeType when DateTimeType == typeof(DateTime):
+ throw new NotSupportedException();
case Type byteType when byteType == typeof(byte):
case Type charType when charType == typeof(char):
case Type doubleType when doubleType == typeof(double):
@@ -2286,6 +2382,8 @@ internal PrimitiveDataFrameColumn ElementwiseLessThanOrEqualImplementation
decimalColumn._columnContainer.ElementwiseLessThanOrEqual(DecimalConverter.Instance.GetDecimal(value), newColumn._columnContainer);
return newColumn;
}
+ case Type DateTimeType when DateTimeType == typeof(DateTime):
+ throw new NotSupportedException();
case Type byteType when byteType == typeof(byte):
case Type charType when charType == typeof(char):
case Type doubleType when doubleType == typeof(double):
@@ -2361,6 +2459,8 @@ internal PrimitiveDataFrameColumn ElementwiseGreaterThanImplementation(
decimalColumn._columnContainer.ElementwiseGreaterThan(column.CloneAsDecimalColumn()._columnContainer, newColumn._columnContainer);
return newColumn;
}
+ case Type DateTimeType when DateTimeType == typeof(DateTime):
+ throw new NotSupportedException();
case Type byteType when byteType == typeof(byte):
case Type charType when charType == typeof(char):
case Type doubleType when doubleType == typeof(double):
@@ -2431,6 +2531,8 @@ internal PrimitiveDataFrameColumn ElementwiseGreaterThanImplementation(
decimalColumn._columnContainer.ElementwiseGreaterThan(DecimalConverter.Instance.GetDecimal(value), newColumn._columnContainer);
return newColumn;
}
+ case Type DateTimeType when DateTimeType == typeof(DateTime):
+ throw new NotSupportedException();
case Type byteType when byteType == typeof(byte):
case Type charType when charType == typeof(char):
case Type doubleType when doubleType == typeof(double):
@@ -2506,6 +2608,8 @@ internal PrimitiveDataFrameColumn ElementwiseLessThanImplementation(Pri
decimalColumn._columnContainer.ElementwiseLessThan(column.CloneAsDecimalColumn()._columnContainer, newColumn._columnContainer);
return newColumn;
}
+ case Type DateTimeType when DateTimeType == typeof(DateTime):
+ throw new NotSupportedException();
case Type byteType when byteType == typeof(byte):
case Type charType when charType == typeof(char):
case Type doubleType when doubleType == typeof(double):
@@ -2576,6 +2680,8 @@ internal PrimitiveDataFrameColumn ElementwiseLessThanImplementation(U v
decimalColumn._columnContainer.ElementwiseLessThan(DecimalConverter.Instance.GetDecimal(value), newColumn._columnContainer);
return newColumn;
}
+ case Type DateTimeType when DateTimeType == typeof(DateTime):
+ throw new NotSupportedException();
case Type byteType when byteType == typeof(byte):
case Type charType when charType == typeof(char):
case Type doubleType when doubleType == typeof(double):
diff --git a/src/Microsoft.Data.Analysis/PrimitiveDataFrameColumn.BinaryOperations.tt b/src/Microsoft.Data.Analysis/PrimitiveDataFrameColumn.BinaryOperations.tt
index 6809de48d1..bbe3cdbb0f 100644
--- a/src/Microsoft.Data.Analysis/PrimitiveDataFrameColumn.BinaryOperations.tt
+++ b/src/Microsoft.Data.Analysis/PrimitiveDataFrameColumn.BinaryOperations.tt
@@ -169,32 +169,32 @@ namespace Microsoft.Data.Analysis
switch (typeof(T))
{
<# foreach (TypeConfiguration type in typeConfiguration) { #>
-<# if (type.TypeName == "bool") { #>
+<# if (type.TypeName == "bool" || type.TypeName == "DateTime") { #>
case Type <#=type.TypeName#>Type when <#=type.TypeName#>Type == typeof(<#=type.TypeName#>):
<# if (method.IsNumeric == true) { #>
throw new NotSupportedException();
<# } else { #>
- if (typeof(U) != typeof(bool))
+ if (typeof(U) != typeof(<#=type.TypeName#>))
{
throw new NotSupportedException();
}
<# if (method.MethodType == MethodType.ComparisonScalar || method.MethodType == MethodType.Comparison) { #>
- PrimitiveDataFrameColumn retColumn = CloneAsBooleanColumn();
+ PrimitiveDataFrameColumn ret<#=type.TypeName#>Column = CloneAsBooleanColumn();
<# if (method.MethodType == MethodType.ComparisonScalar) { #>
- (this as PrimitiveDataFrameColumn)._columnContainer.<#=method.MethodName#>(Unsafe.As(ref value), retColumn._columnContainer);
+ (this as PrimitiveDataFrameColumn)._columnContainer.<#=method.MethodName#>(Unsafe.As(ref value), ret<#=type.TypeName#>Column._columnContainer);
<# } else { #>
- (this as PrimitiveDataFrameColumn)._columnContainer.<#=method.MethodName#>(column._columnContainer, retColumn._columnContainer);
+ (this as PrimitiveDataFrameColumn)._columnContainer.<#=method.MethodName#>(column._columnContainer, ret<#=type.TypeName#>Column._columnContainer);
<# } #>
<# } else if (method.MethodType == MethodType.BinaryScalar) {#>
PrimitiveDataFrameColumn column = this as PrimitiveDataFrameColumn;
- PrimitiveDataFrameColumn retColumn = <#=GenerateInPlaceStatement("column", "column.Clone()")#>;
- retColumn._columnContainer.<#=method.MethodName#>(value);
+ PrimitiveDataFrameColumn ret<#=type.TypeName#>Column = <#=GenerateInPlaceStatement("column", "column.Clone()")#>;
+ ret<#=type.TypeName#>Column._columnContainer.<#=method.MethodName#>(value);
<# } else { #>
PrimitiveDataFrameColumn column = this as PrimitiveDataFrameColumn;
- PrimitiveDataFrameColumn retColumn = <#=GenerateInPlaceStatement("column", "column.Clone()")#>;
- retColumn._columnContainer.<#=method.MethodName#>(column._columnContainer);
+ PrimitiveDataFrameColumn ret<#=type.TypeName#>Column = <#=GenerateInPlaceStatement("column", "column.Clone()")#>;
+ ret<#=type.TypeName#>Column._columnContainer.<#=method.MethodName#>(column._columnContainer);
<# } #>
- return retColumn;
+ return ret<#=type.TypeName#>Column;
<# } #>
<# } else if (type.TypeName == "decimal") { #>
case Type <#=type.TypeName#>Type when <#=type.TypeName#>Type == typeof(<#=type.TypeName#>):
@@ -231,7 +231,7 @@ namespace Microsoft.Data.Analysis
return newColumn;
<# } #>
}
- else
+ else
{
<# if (method.MethodType == MethodType.BinaryScalar) { #>
if (inPlace)
@@ -314,7 +314,7 @@ namespace Microsoft.Data.Analysis
return newColumn;
<# } #>
}
- else
+ else
{
<# if (method.MethodType == MethodType.BinaryScalar) { #>
if (inPlace)
diff --git a/src/Microsoft.Data.Analysis/PrimitiveDataFrameColumn.ReversedBinaryOperations.cs b/src/Microsoft.Data.Analysis/PrimitiveDataFrameColumn.ReversedBinaryOperations.cs
index 80f003cd68..3cc07217e3 100644
--- a/src/Microsoft.Data.Analysis/PrimitiveDataFrameColumn.ReversedBinaryOperations.cs
+++ b/src/Microsoft.Data.Analysis/PrimitiveDataFrameColumn.ReversedBinaryOperations.cs
@@ -55,6 +55,7 @@ public override DataFrameColumn ReverseAdd(U value, bool inPlace = false)
case PrimitiveDataFrameColumn uintColumn:
case PrimitiveDataFrameColumn ulongColumn:
case PrimitiveDataFrameColumn ushortColumn:
+ case PrimitiveDataFrameColumn DateTimeColumn:
if (typeof(U) == typeof(bool))
{
throw new NotSupportedException();
@@ -129,6 +130,7 @@ public override DataFrameColumn ReverseSubtract(U value, bool inPlace = false
case PrimitiveDataFrameColumn uintColumn:
case PrimitiveDataFrameColumn ulongColumn:
case PrimitiveDataFrameColumn ushortColumn:
+ case PrimitiveDataFrameColumn DateTimeColumn:
if (typeof(U) == typeof(bool))
{
throw new NotSupportedException();
@@ -203,6 +205,7 @@ public override DataFrameColumn ReverseMultiply(U value, bool inPlace = false
case PrimitiveDataFrameColumn uintColumn:
case PrimitiveDataFrameColumn ulongColumn:
case PrimitiveDataFrameColumn ushortColumn:
+ case PrimitiveDataFrameColumn DateTimeColumn:
if (typeof(U) == typeof(bool))
{
throw new NotSupportedException();
@@ -277,6 +280,7 @@ public override DataFrameColumn ReverseDivide(U value, bool inPlace = false)
case PrimitiveDataFrameColumn uintColumn:
case PrimitiveDataFrameColumn ulongColumn:
case PrimitiveDataFrameColumn ushortColumn:
+ case PrimitiveDataFrameColumn DateTimeColumn:
if (typeof(U) == typeof(bool))
{
throw new NotSupportedException();
@@ -351,6 +355,7 @@ public override DataFrameColumn ReverseModulo(U value, bool inPlace = false)
case PrimitiveDataFrameColumn uintColumn:
case PrimitiveDataFrameColumn ulongColumn:
case PrimitiveDataFrameColumn ushortColumn:
+ case PrimitiveDataFrameColumn DateTimeColumn:
if (typeof(U) == typeof(bool))
{
throw new NotSupportedException();
@@ -396,7 +401,6 @@ public override PrimitiveDataFrameColumn ReverseAnd(bool value, bool inPla
return retColumn;
default:
throw new NotSupportedException();
-
}
}
///
@@ -410,7 +414,6 @@ public override PrimitiveDataFrameColumn ReverseOr(bool value, bool inPlac
return retColumn;
default:
throw new NotSupportedException();
-
}
}
///
@@ -424,10 +427,7 @@ public override PrimitiveDataFrameColumn ReverseXor(bool value, bool inPla
return retColumn;
default:
throw new NotSupportedException();
-
}
}
-
-
}
}
diff --git a/src/Microsoft.Data.Analysis/PrimitiveDataFrameColumn.ReversedBinaryOperations.tt b/src/Microsoft.Data.Analysis/PrimitiveDataFrameColumn.ReversedBinaryOperations.tt
index 68382f5b92..6bb592486e 100644
--- a/src/Microsoft.Data.Analysis/PrimitiveDataFrameColumn.ReversedBinaryOperations.tt
+++ b/src/Microsoft.Data.Analysis/PrimitiveDataFrameColumn.ReversedBinaryOperations.tt
@@ -40,7 +40,6 @@ namespace Microsoft.Data.Analysis
return retColumn;
default:
throw new NotSupportedException();
-
}
<# } else { #>
switch (this)
@@ -113,7 +112,5 @@ namespace Microsoft.Data.Analysis
}
<# } #>
<# } #>
-
-
}
}
diff --git a/src/Microsoft.Data.Analysis/PrimitiveDataFrameColumn.cs b/src/Microsoft.Data.Analysis/PrimitiveDataFrameColumn.cs
index 730b8ddfd6..3cd6799780 100644
--- a/src/Microsoft.Data.Analysis/PrimitiveDataFrameColumn.cs
+++ b/src/Microsoft.Data.Analysis/PrimitiveDataFrameColumn.cs
@@ -282,7 +282,7 @@ public override long NullCount
public override bool IsNumericColumn()
{
bool ret = true;
- if (typeof(T) == typeof(char) || typeof(T) == typeof(bool))
+ if (typeof(T) == typeof(char) || typeof(T) == typeof(bool) || typeof(T) == typeof(DateTime))
ret = false;
return ret;
}
@@ -325,7 +325,10 @@ public override DataFrame ValueCounts()
}
///
- public override bool HasDescription() => IsNumericColumn();
+ public override bool HasDescription()
+ {
+ return this.IsNumericColumn() || typeof(T) == typeof(DateTime);
+ }
///
/// Returns a preview of the column contents as a formatted string.
@@ -701,6 +704,10 @@ private static DataViewType GetDataViewType()
{
return NumberDataViewType.Double;
}
+ else if (typeof(T) == typeof(DateTime))
+ {
+ return DateTimeDataViewType.Instance;
+ }
else if (typeof(T) == typeof(float))
{
return NumberDataViewType.Single;
@@ -744,7 +751,7 @@ private static DataViewType GetDataViewType()
return NumberDataViewType.Double;
}
- throw new NotSupportedException();
+ throw new NotSupportedException("Type is " + typeof(T).Name);
}
protected internal override Delegate GetDataViewGetter(DataViewRowCursor cursor)
diff --git a/src/Microsoft.Data.Analysis/PrimitiveDataFrameColumnArithmetic.cs b/src/Microsoft.Data.Analysis/PrimitiveDataFrameColumnArithmetic.cs
index 84dd3bdec4..f432805185 100644
--- a/src/Microsoft.Data.Analysis/PrimitiveDataFrameColumnArithmetic.cs
+++ b/src/Microsoft.Data.Analysis/PrimitiveDataFrameColumnArithmetic.cs
@@ -116,6 +116,10 @@ public static IPrimitiveDataFrameColumnArithmetic GetArithmetic()
{
return (IPrimitiveDataFrameColumnArithmetic)new UShortArithmetic();
}
+ else if (typeof(T) == typeof(DateTime))
+ {
+ return (IPrimitiveDataFrameColumnArithmetic)new DateTimeArithmetic();
+ }
throw new NotSupportedException();
}
}
@@ -130,7 +134,6 @@ public void Add(PrimitiveColumnContainer column, bool scalar)
{
throw new NotSupportedException();
}
-
public void Add(bool scalar, PrimitiveColumnContainer column)
{
throw new NotSupportedException();
@@ -143,7 +146,6 @@ public void Subtract(PrimitiveColumnContainer column, bool scalar)
{
throw new NotSupportedException();
}
-
public void Subtract(bool scalar, PrimitiveColumnContainer column)
{
throw new NotSupportedException();
@@ -156,7 +158,6 @@ public void Multiply(PrimitiveColumnContainer column, bool scalar)
{
throw new NotSupportedException();
}
-
public void Multiply(bool scalar, PrimitiveColumnContainer column)
{
throw new NotSupportedException();
@@ -169,7 +170,6 @@ public void Divide(PrimitiveColumnContainer column, bool scalar)
{
throw new NotSupportedException();
}
-
public void Divide(bool scalar, PrimitiveColumnContainer column)
{
throw new NotSupportedException();
@@ -182,7 +182,6 @@ public void Modulo(PrimitiveColumnContainer column, bool scalar)
{
throw new NotSupportedException();
}
-
public void Modulo(bool scalar, PrimitiveColumnContainer column)
{
throw new NotSupportedException();
@@ -216,7 +215,6 @@ public void And(PrimitiveColumnContainer column, bool scalar)
}
}
}
-
public void And(bool scalar, PrimitiveColumnContainer column)
{
for (int b = 0; b < column.Buffers.Count; b++)
@@ -260,7 +258,6 @@ public void Or(PrimitiveColumnContainer