You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[Argument(ArgumentType.AtMostOnce,HelpText="The seed for random number generation",ShortName="seed")]
69
69
publicint?Seed;
70
+
71
+
[Argument(ArgumentType.AtMostOnce,HelpText="Column to use for example weight",ShortName="weight",SortOrder=4,Visibility=ArgumentAttribute.VisibilityType.EntryPointsOnly)]
public Microsoft.ML.Transforms.PredictedLabelColumnOriginalValueConverter.Output Add(Microsoft.ML.Transforms.PredictedLabelColumnOriginalValueConverter input)
1094
1118
{
1095
1119
var output = new Microsoft.ML.Transforms.PredictedLabelColumnOriginalValueConverter.Output();
@@ -6739,6 +6763,97 @@ public OrdinaryLeastSquaresRegressorPipelineStep(Output output)
6739
6763
}
6740
6764
}
6741
6765
6766
+
namespace Trainers
6767
+
{
6768
+
6769
+
/// <summary>
6770
+
/// Train an PCA Anomaly model.
6771
+
/// </summary>
6772
+
public sealed partial class PcaAnomalyDetector : Microsoft.ML.Runtime.EntryPoints.CommonInputs.ITrainerInput, Microsoft.ML.ILearningPipelineItem
6773
+
{
6774
+
6775
+
6776
+
/// <summary>
6777
+
/// The number of components in the PCA
6778
+
/// </summary>
6779
+
[TlcModule.SweepableDiscreteParamAttribute("Rank", new object[]{10, 20, 40, 80})]
6780
+
public int Rank { get; set; } = 20;
6781
+
6782
+
/// <summary>
6783
+
/// Oversampling parameter for randomized PCA training
6784
+
/// </summary>
6785
+
[TlcModule.SweepableDiscreteParamAttribute("Oversampling", new object[]{10, 20, 40})]
6786
+
public int Oversampling { get; set; } = 20;
6787
+
6788
+
/// <summary>
6789
+
/// If enabled, data is centered to be zero mean
6790
+
/// </summary>
6791
+
[TlcModule.SweepableDiscreteParamAttribute("Center", new object[]{false, true})]
6792
+
public bool Center { get; set; } = true;
6793
+
6794
+
/// <summary>
6795
+
/// The seed for random number generation
6796
+
/// </summary>
6797
+
public int? Seed { get; set; }
6798
+
6799
+
/// <summary>
6800
+
/// Column to use for example weight
6801
+
/// </summary>
6802
+
public Microsoft.ML.Runtime.EntryPoints.Optional<string> WeightColumn { get; set; }
6803
+
6804
+
/// <summary>
6805
+
/// The data to be used for training
6806
+
/// </summary>
6807
+
public Var<Microsoft.ML.Runtime.Data.IDataView> TrainingData { get; set; } = new Var<Microsoft.ML.Runtime.Data.IDataView>();
6808
+
6809
+
/// <summary>
6810
+
/// Column to use for features
6811
+
/// </summary>
6812
+
public string FeatureColumn { get; set; } = "Features";
6813
+
6814
+
/// <summary>
6815
+
/// Normalize option for the feature column
6816
+
/// </summary>
6817
+
public Models.NormalizeOption NormalizeFeatures { get; set; } = Models.NormalizeOption.Auto;
6818
+
6819
+
/// <summary>
6820
+
/// Whether learner should cache input training data
6821
+
/// </summary>
6822
+
public Models.CachingOptions Caching { get; set; } = Models.CachingOptions.Auto;
6823
+
6824
+
6825
+
public sealed class Output : Microsoft.ML.Runtime.EntryPoints.CommonOutputs.IAnomalyDetectionOutput, Microsoft.ML.Runtime.EntryPoints.CommonOutputs.ITrainerOutput
6826
+
{
6827
+
/// <summary>
6828
+
/// The trained model
6829
+
/// </summary>
6830
+
public Var<Microsoft.ML.Runtime.EntryPoints.IPredictorModel> PredictorModel { get; set; } = new Var<Microsoft.ML.Runtime.EntryPoints.IPredictorModel>();
6831
+
6832
+
}
6833
+
public ILearningPipelineStep ApplyStep(ILearningPipelineStep previousStep, Experiment experiment)
6834
+
{
6835
+
if (!(previousStep is ILearningPipelineDataStep dataStep))
6836
+
{
6837
+
throw new InvalidOperationException($"{ nameof(PcaAnomalyDetector)} only supports an { nameof(ILearningPipelineDataStep)} as an input.");
6838
+
}
6839
+
6840
+
TrainingData = dataStep.Data;
6841
+
Output output = experiment.Add(this);
6842
+
return new PcaAnomalyDetectorPipelineStep(output);
6843
+
}
6844
+
6845
+
private class PcaAnomalyDetectorPipelineStep : ILearningPipelinePredictorStep
6846
+
{
6847
+
public PcaAnomalyDetectorPipelineStep(Output output)
6848
+
{
6849
+
Model = output.PredictorModel;
6850
+
}
6851
+
6852
+
public Var<IPredictorModel> Model { get; }
6853
+
}
6854
+
}
6855
+
}
6856
+
6742
6857
namespace Trainers
6743
6858
{
6744
6859
@@ -11417,6 +11532,170 @@ public OptionalColumnCreatorPipelineStep(Output output)
11417
11532
}
11418
11533
}
11419
11534
11535
+
namespace Transforms
11536
+
{
11537
+
11538
+
public sealed partial class PcaTransformColumn : OneToOneColumn<PcaTransformColumn>, IOneToOneColumn
11539
+
{
11540
+
/// <summary>
11541
+
/// The name of the weight column
11542
+
/// </summary>
11543
+
public string WeightColumn { get; set; }
11544
+
11545
+
/// <summary>
11546
+
/// The number of components in the PCA
11547
+
/// </summary>
11548
+
public int? Rank { get; set; }
11549
+
11550
+
/// <summary>
11551
+
/// Oversampling parameter for randomized PCA training
11552
+
/// </summary>
11553
+
public int? Oversampling { get; set; }
11554
+
11555
+
/// <summary>
11556
+
/// If enabled, data is centered to be zero mean
11557
+
/// </summary>
11558
+
public bool? Center { get; set; }
11559
+
11560
+
/// <summary>
11561
+
/// The seed for random number generation
11562
+
/// </summary>
11563
+
public int? Seed { get; set; }
11564
+
11565
+
/// <summary>
11566
+
/// Name of the new column
11567
+
/// </summary>
11568
+
public string Name { get; set; }
11569
+
11570
+
/// <summary>
11571
+
/// Name of the source column
11572
+
/// </summary>
11573
+
public string Source { get; set; }
11574
+
11575
+
}
11576
+
11577
+
/// <summary>
11578
+
/// Train an PCA Anomaly model.
11579
+
/// </summary>
11580
+
public sealed partial class PcaCalculator : Microsoft.ML.Runtime.EntryPoints.CommonInputs.ITransformInput, Microsoft.ML.ILearningPipelineItem
11581
+
{
11582
+
11583
+
public PcaCalculator()
11584
+
{
11585
+
}
11586
+
11587
+
public PcaCalculator(params string[] inputColumns)
11588
+
{
11589
+
if (inputColumns != null)
11590
+
{
11591
+
foreach (string input in inputColumns)
11592
+
{
11593
+
AddColumn(input);
11594
+
}
11595
+
}
11596
+
}
11597
+
11598
+
public PcaCalculator(params ValueTuple<string, string>[] inputOutputColumns)
11599
+
{
11600
+
if (inputOutputColumns != null)
11601
+
{
11602
+
foreach (ValueTuple<string, string> inputOutput in inputOutputColumns)
11603
+
{
11604
+
AddColumn(inputOutput.Item2, inputOutput.Item1);
11605
+
}
11606
+
}
11607
+
}
11608
+
11609
+
public void AddColumn(string source)
11610
+
{
11611
+
var list = Column == null ? new List<Transforms.PcaTransformColumn>() : new List<Transforms.PcaTransformColumn>(Column);
0 commit comments