/// <summary> /// Trains an approximate PCA using Randomized SVD algorithm. /// </summary> /// <param name="catalog">The anomaly detection catalog trainer object.</param> /// <param name="options">Advanced options to the algorithm.</param> /// <example> /// <format type="text/markdown"> /// <![CDATA[ /// [!code-csharp[RPCA](~/../docs/samples/docs/samples/Microsoft.ML.Samples/Dynamic/Trainers/AnomalyDetection/RandomizedPcaSampleWithOptions.cs)] /// ]]></format> /// </example> public static RandomizedPcaTrainer RandomizedPca(this AnomalyDetectionCatalog.AnomalyDetectionTrainers catalog, Options options) { Contracts.CheckValue(catalog, nameof(catalog)); var env = CatalogUtils.GetEnvironment(catalog); return(new RandomizedPcaTrainer(env, options)); }
/// <summary> /// Trains an approximate PCA using Randomized SVD algorithm. /// </summary> /// <param name="catalog">The anomaly detection catalog trainer object.</param> /// <param name="featureColumnName">The name of the feature column.</param> /// <param name="exampleWeightColumnName">The name of the example weight column (optional).</param> /// <param name="rank">The number of components in the PCA.</param> /// <param name="oversampling">Oversampling parameter for randomized PCA training.</param> /// <param name="center">If enabled, data is centered to be zero mean.</param> /// <param name="seed">The seed for random number generation.</param> /// <example> /// <format type="text/markdown"> /// <![CDATA[ /// [!code-csharp[RPCA](~/../docs/samples/docs/samples/Microsoft.ML.Samples/Dynamic/Trainers/AnomalyDetection/RandomizedPcaSample.cs)] /// ]]></format> /// </example> public static RandomizedPcaTrainer RandomizedPca(this AnomalyDetectionCatalog.AnomalyDetectionTrainers catalog, string featureColumnName = DefaultColumnNames.Features, string exampleWeightColumnName = null, int rank = Options.Defaults.NumComponents, int oversampling = Options.Defaults.OversamplingParameters, bool center = Options.Defaults.IsCenteredZeroMean, int?seed = null) { Contracts.CheckValue(catalog, nameof(catalog)); var env = CatalogUtils.GetEnvironment(catalog); return(new RandomizedPcaTrainer(env, featureColumnName, exampleWeightColumnName, rank, oversampling, center, seed)); }