306 references to Check
Microsoft.ML.Core (15)
Data\ColumnTypeExtensions.cs (1)
37ectx.Check(count <= int.MaxValue, nameof(KeyDataViewType) + "." + nameof(KeyDataViewType.Count) + " exceeds int.MaxValue.");
Data\KeyTypeExtensions.cs (1)
20ectx.Check(key.Count <= int.MaxValue, nameof(KeyDataViewType) + "." + nameof(KeyDataViewType.Count) + " exceeds int.MaxValue.");
Data\ModelLoading.cs (4)
135_ectx.Check(InRepository, "Can't load a sub-model when reading from a single stream"); 304_ectx.Check(InRepository, "Can't Load a sub-model when reading from a single stream"); 328_ectx.Check(InRepository, "Can't Load a sub-model when reading from a single stream"); 349_ectx.Check(InRepository, "Can't Load a sub-model when reading from a single stream");
Data\ModelSaveContext.cs (3)
157_ectx.Check(InRepository, "Can't save a text stream when writing to a single stream"); 173_ectx.Check(InRepository, "Can't save a text stream when writing to a single stream"); 240_ectx.Check(Header.ModelSignature != 0, "ModelSignature not specified!");
Data\ModelSaving.cs (2)
21_ectx.Check(InRepository, "Can't save a sub-model when writing to a single stream"); 80_ectx.Check(InRepository, "Can't save a sub-model when writing to a single stream");
Data\ProgressReporter.cs (2)
74_ectx.Check(!_isDisposed, "Can't report checkpoints after disposing"); 94_ectx.Check(iSrc == n, "Too many values provided in Checkpoint");
Data\ServerChannel.cs (2)
84_chp.Check(_published == null, "Cannot expose more interfaces once a server channel has been published"); 124_chp.Check(_published == null, "Cannot republish once a server channel has been published");
Microsoft.ML.Data (148)
Commands\DataCommand.cs (2)
73ch.Check(Host != null, nameof(InitServer) + " called prematurely"); 267Host.Check(predictor != null, "Could not load predictor from model file");
Commands\SaveDataCommand.cs (2)
156Host.NotSensitive().Check(cols.Count > 0, "No valid columns to save"); 219ch.Check(cols.Count > 0, "No valid columns to save");
Commands\ScoreCommand.cs (1)
200ch.Check(cols.Count > 0, "No valid columns to save");
Data\DataViewUtils.cs (2)
1237Ch.Check(_icursor >= 0, RowCursorUtils.FetchValueStateError); 1263Ch.Check(_icursor >= 0, RowCursorUtils.FetchValueStateError);
Data\RowCursorUtils.cs (2)
579Ch.Check(IsGood, "Cannot call value getter in current state"); 601Ch.Check(IsGood, RowCursorUtils.FetchValueStateError);
Data\SchemaDefinition.cs (3)
175ectx.Check(cursorChannelAttrMembers.Length == 1, 183ectx.Check(cursorChannelAttrFieldInfo.FieldType == typeof(IChannel), 189ectx.Check(cursorChannelAttrPropertyInfo.PropertyType == typeof(IChannel),
DataLoadSave\Binary\BinaryLoader.cs (3)
1664Ectx.Check(_curr != null, RowCursorUtils.FetchValueStateError); 2067Ch.Check(IsGood, RowCursorUtils.FetchValueStateError); 2086Ch.Check(IsGood, RowCursorUtils.FetchValueStateError);
DataLoadSave\Binary\BinarySaver.cs (2)
283_host.Check(!string.IsNullOrEmpty(metaColumn.Name), "Metadata with null or empty kind detected, disallowed"); 284_host.Check(metaColumn.Type != null, "Metadata with null type detected, disallowed");
DataLoadSave\Database\DatabaseLoaderCursor.cs (1)
110Ch.Check(IsGood, RowCursorUtils.FetchValueStateError);
DataLoadSave\LegacyCompositeDataLoader.cs (1)
238ch.Check(curDataView == pipeStart,
DataLoadSave\Text\TextLoader.cs (1)
1202_host.Check(_inputSize >= 0, "inputSize");
DataLoadSave\Text\TextLoaderCursor.cs (1)
204Ch.Check(IsGood, RowCursorUtils.FetchValueStateError);
DataLoadSave\Transpose\TransposeLoader.cs (3)
401_host.Check(file.Count == 1, "Transposed loader accepts a single file only"); 430_host.Check(file.Count == 1, "Transposed loader accepts a single file only"); 849Ch.Check(IsGood, RowCursorUtils.FetchValueStateError);
DataView\AppendRowsDataView.cs (8)
113_host.Check(_sources.All(source => source.Schema.Count == colCount), errMsg); 123_host.Check(schema[c].Name == name, errMsg); 124_host.Check(schema[c].Type.SameSizeAndItemType(type), errMsg); 137_host.Check(cur.Value >= 0, "One of the sources returned a negative row count"); 206Ch.Check(column.Index < Schema.Count, "Column index is out of range"); 255Ch.Check(Position >= 0, RowCursorUtils.FetchValueStateError); 342Ch.Check(IsGood, RowCursorUtils.FetchValueStateError); 354Ch.Check(Position >= 0, RowCursorUtils.FetchValueStateError);
DataView\ArrayDataViewBuilder.cs (6)
188_host.Check(!RowCount.HasValue || RowCount.Value == rowCount.Value, "Specified row count incompatible with existing columns"); 191_host.Check(_columns.Count > 0, "Cannot construct data-view with neither any columns nor a specified row count"); 292Ch.Check(IsGood, RowCursorUtils.FetchValueStateError); 301Ch.Check(IsGood, RowCursorUtils.FetchValueStateError); 326Ch.Check(column.Index < _active.Length && _active[column.Index], "the requested column is not active"); 337Ch.Check(IsGood, RowCursorUtils.FetchValueStateError);
DataView\BatchDataViewMapperBase.cs (1)
135Ch.Check(IsGood, "Cannot call ID getter in current state");
DataView\CacheDataView.cs (2)
495Ch.Check(Position >= 0, RowCursorUtils.FetchValueStateError); 545Ch.Check(Position >= 0, RowCursorUtils.FetchValueStateError);
DataView\DataViewConstructionUtils.cs (6)
182Host.Check(Position >= 0, RowCursorUtils.FetchValueStateError); 653Ch.Check(IsGood, RowCursorUtils.FetchValueStateError); 662Ch.Check(IsGood, RowCursorUtils.FetchValueStateError); 670Ch.Check(0 <= Position && Position < _data.Count, RowCursorUtils.FetchValueStateError); 726Ch.Check(IsGood, RowCursorUtils.FetchValueStateError); 794Ch.Check(IsGood, RowCursorUtils.FetchValueStateError);
DataView\RowToRowMapperTransform.cs (3)
222Host.Check(onnx.CanSaveOnnx(ctx), "Cannot be saved as ONNX."); 232Host.Check(pfa.CanSavePfa, "Cannot be saved as PFA."); 253Host.Check(input.Schema == Source.Schema, "Schema of input row must be the same as the schema the mapper is bound to");
DataView\Transposer.cs (6)
380Ch.Check(IsGood, RowCursorUtils.FetchValueStateError); 512Ch.Check(IsGood, RowCursorUtils.FetchValueStateError); 697Ch.Check(IsGood, RowCursorUtils.FetchValueStateError); 1300Ch.Check(column.Index < Schema.Count, nameof(column)); 1516Ch.Check(_slotCursor.SlotIndex >= 0, RowCursorUtils.FetchValueStateError); 1571Ch.Check(_slotCursor.SlotIndex >= 0, RowCursorUtils.FetchValueStateError);
DataView\TypedCursor.cs (1)
640Ch.Check(Position >= 0, "Cannot fill values. The cursor is not active.");
DataView\ZipDataView.cs (2)
67_host.Check(cur.Value >= 0, "One of the sources returned a negative row count"); 146Ch.Check(IsGood, RowCursorUtils.FetchValueStateError);
EntryPoints\InputBuilder.cs (8)
423ectx.Check(VariableBinding.IsBindingToken(value), "Variable name expected."); 461ectx.Check(ja != null, "Expected array value"); 479ectx.Check(value is JObject, "Expected object value"); 484ectx.Check(jo != null, "Expected object value"); 487ectx.Check(jName != null, "Field '" + FieldNames.Name + "' is required for component."); 488ectx.Check(jName is JValue, "Expected '" + FieldNames.Name + "' field to be a string."); 490ectx.Check(jo[FieldNames.Settings] == null || jo[FieldNames.Settings] is JObject, 495ectx.Check(settings != null, "Expected object value");
EntryPoints\SummarizePredictor.cs (1)
67env.Check(dvGetter == null || row == null,
EntryPoints\TransformModelImpl.cs (1)
253_ectx.Check(input.Schema == InputSchema, "Schema of input row must be the same as the schema the mapper is bound to");
Evaluators\AnomalyDetectionEvaluator.cs (1)
101Host.Check(schema.Label.HasValue, "Could not find the label column");
Evaluators\BinaryClassifierEvaluator.cs (3)
133host.Check(schema.Label.HasValue, "Could not find the label column"); 256Host.Check(agg.Weighted == hasWeight, "All aggregators must either be weighted or unweighted"); 257Host.Check((agg.AuPrcAggregator == null) == (aggregator.AuPrcAggregator == null),
Evaluators\ClusteringEvaluator.cs (2)
175Host.Check(agg.Weighted == hasWeight, "All aggregators must either be weighted or unweighted"); 176Host.Check(agg.UnweightedCounters.CalculateDbi == aggregator.UnweightedCounters.CalculateDbi,
Evaluators\EvaluatorBase.cs (1)
260Host.Check(PassNum == -1, "Start() should only be called before processing any data.");
Evaluators\EvaluatorUtils.cs (2)
1776env.Check(type.GetKeyCount() > 0, "Expected a known count key type stratification column"); 1784env.Check(found, "If stratification column exist, data view must also contain a StratVal column");
Evaluators\MulticlassClassificationEvaluator.cs (2)
164Host.Check(agg.Weighted == hasWeight, "All aggregators must either be weighted or unweighted"); 165Host.Check((agg.UnweightedCounters.OutputTopKAcc > 0) == (aggregator.UnweightedCounters.OutputTopKAcc > 0),
Evaluators\MultiOutputRegressionEvaluator.cs (3)
64Host.Check(schema.Label.HasValue, "Could not find the label column"); 115Host.Check(agg.Weighted == hasWeight, "All aggregators must either be weighted or unweighted"); 714ch.Check(labelCount == type.Size, "All vector metrics should contain the same number of slots");
Evaluators\QuantileRegressionEvaluator.cs (1)
48Host.Check(type != null && type.IsKnownSize && type.ItemType is TextDataViewType, "Quantile regression score column must have slot names");
Evaluators\RankingEvaluator.cs (2)
181Host.Check(agg.Weighted == hasWeight, "All aggregators must either be weighted or unweighted"); 182Host.Check(agg.UnweightedCounters.GroupSummary == aggregator.UnweightedCounters.GroupSummary,
Evaluators\RegressionEvaluatorBase.cs (1)
68Host.Check(agg.Weighted == hasWeight, "All aggregators must either be weighted or unweighted");
Model\Pfa\BoundPfaContext.cs (2)
87_host.Check(fields.Count >= 1, "Schema produced no inputs for the PFA conversion."); 148_host.Check(fields.Count >= 1, "Pipeline produced no outputs for the PFA conversion");
Prediction\Calibrator.cs (15)
227Host.Check(calibrator == null, "Too many calibrators."); 313Host.Check(_mapper != null, "The predictor does not implement IValueMapper"); 314Host.Check(_mapper.OutputType == NumberDataViewType.Single, "The output type of the predictor is expected to be float"); 341Host.Check(_featureContribution != null, "Predictor does not implement IFeatureContributionMapper"); 506Host.Check(SubModel is IPredictorWithFeatureWeights<float>, "Predictor does not implement " + nameof(IPredictorWithFeatureWeights<float>)); 559Host.Check(predictor is IParameterMixer<float>, "Predictor does not implement " + nameof(IParameterMixer<float>)); 560Host.Check(calibrator is IParameterMixer, "Calibrator does not implement " + nameof(IParameterMixer)); 582Host.Check(SubModel is IParameterMixer<float>, "Predictor does not implement " + nameof(IParameterMixer)); 583Host.Check(SubModel is IPredictorWithFeatureWeights<float>, "Predictor does not implement " + nameof(IPredictorWithFeatureWeights<float>)); 665env.Check(_predictor != null, "Predictor is not a row-to-row mapper"); 786Host.Check(((ICanSavePfa)this).CanSavePfa, "Called despite not being savable"); 796Host.Check(((ICanSaveOnnx)this).CanSaveOnnx(ctx), "Called despite not being savable"); 810Host.Check(_featureContribution != null, "Predictor does not implement " + nameof(IFeatureContributionMapper)); 1122ch.Check(cOutputs.Length > 0, "Calibrator trained on zero instances."); 1452ch.Check(Data != null, "Calibrator trained on zero instances.");
Prediction\CalibratorCatalog.cs (2)
258parent.Host.Check(_scoreColIndex >= 0, "The data to calibrate contains no \'" + scoreColumnName + "\' column."); 273Host.Check(onnx.CanSaveOnnx(ctx), "Cannot be saved as ONNX.");
Scorers\PredictedLabelScorerBase.cs (2)
120env.Check(tmp, "Mapper doesn't have expected score column"); 301Host.Check(outputTypeMatches(scoreType), "Unexpected predictor output type");
Scorers\QuantileRegressionScorer.cs (1)
47env.Check(pred != null, "Predictor doesn't support quantile regression");
Training\TrainerEstimatorBase.cs (1)
101Host.Check(pred != null, "Training did not return a predictor.");
Transforms\BindingsWrappedRowCursor.cs (2)
42Ch.Check(column.Index < _bindings.ColumnCount, nameof(column)); 57Ch.Check(IsColumnActive(column), nameof(column));
Transforms\ColumnSelecting.cs (5)
235_host.Check(!(keepValid && dropValid), "Both " + nameof(keepColumns) + " and " + nameof(dropColumns) + " are set. Exactly one can be specified."); 237_host.Check(!(!keepValid && !dropValid), "Neither " + nameof(keepColumns) + " and " + nameof(dropColumns) + " is set. Exactly one must be specified."); 346env.Check(HiddenColumnOption.Rename != hiddenOption, renameNotSupportedMsg); 362env.Check(colHiddenOption != HiddenColumnOption.Rename, renameNotSupportedMsg); 364env.Check(colKeepHidden == keepHidden, differentHideColumnNotSupportedMsg);
Transforms\GenerateNumberTransform.cs (2)
455Ch.Check(IsGood, RowCursorUtils.FetchValueStateError); 474Ch.Check(IsGood, RowCursorUtils.FetchValueStateError);
Transforms\KeyToValue.cs (2)
231Host.Check(typeVals != null, "Metadata KeyValues does not exist"); 234Host.Check(typeVals.GetVectorSize() == srcItemType.GetKeyCountAsInt32(Host), "KeyValues metadata size does not match column type key count");
Transforms\MetadataDispatcher.cs (1)
277ectx.Check(_sealed, "MetadataDispatcher not sealed");
Transforms\NormalizeColumnDbl.cs (6)
667host.Check(typeSrc.RawType == typeof(TFloat), "The column type must be R8."); 731host.Check(typeSrc.ItemType.RawType == typeof(TFloat), "The column type must be vector of Double."); 992host.Check(typeSrc.RawType == typeof(TFloat), "The column type must be Double."); 1057host.Check(typeSrc.ItemType.RawType == typeof(TFloat), "The column type must be vector of Double."); 1175host.Check(typeSrc.RawType == typeof(TFloat), "The column type must be Double."); 1260host.Check(typeSrc.ItemType.RawType == typeof(TFloat), "The column type must be vector of Double.");
Transforms\NormalizeColumnSng.cs (6)
825host.Check(typeSrc.RawType == typeof(TFloat), "The column type must be Single."); 888host.Check(typeSrc.ItemType.RawType == typeof(TFloat), "The column type must be vector of Single."); 1152host.Check(typeSrc.RawType == typeof(TFloat), "The column type must be Single."); 1217host.Check(typeSrc.ItemType.RawType == typeof(TFloat), "The column type must be vector of Single."); 1336host.Check(typeSrc.RawType == typeof(TFloat), "The column type must be Single."); 1421host.Check(typeSrc.ItemType.RawType == typeof(TFloat), "The column type must be vector of Single.");
Transforms\PerGroupTransformBase.cs (1)
318Ch.Check(IsGood, RowCursorUtils.FetchValueStateError);
Transforms\RangeFilter.cs (3)
362Ch.Check(IsGood, RowCursorUtils.FetchValueStateError); 395Ch.Check(IsGood, RowCursorUtils.FetchValueStateError); 431Ch.Check(IsGood, RowCursorUtils.FetchValueStateError);
Transforms\TransformBase.cs (1)
180Host.Check(input.Schema == Source.Schema, "Schema of input row must be the same as the schema the mapper is bound to");
Transforms\ValueMapping.cs (8)
447Host.Check(column.HasValue, "The selected column " + nameof(keyColumn) + " is not included in the targeted IDataView " + nameof(dataView)); 449Host.Check(retrievedKeyColumn.Index == keyColumn.Index, nameof(keyColumn) + "'s column index doesn't match that of the associated column in " + nameof(dataView)); 450Host.Check(retrievedKeyColumn.Type == keyColumn.Type, nameof(keyColumn) + "'s column type doesn't match that of the associated column in " + nameof(dataView)); 451Host.Check(retrievedKeyColumn.Annotations == keyColumn.Annotations, nameof(keyColumn) + "'s column annotations don't match those of the associated column in " + nameof(dataView)); 455Host.Check(column.HasValue, "The selected column " + nameof(valueColumn) + " is not included in the targeted IDataView " + nameof(dataView)); 457Host.Check(retrievedValueColumn.Index == valueColumn.Index, nameof(valueColumn) + "'s column index doesn't match that of the associated column in " + nameof(dataView)); 458Host.Check(retrievedValueColumn.Type == valueColumn.Type, nameof(valueColumn) + "'s column type doesn't match that of the associated column in " + nameof(dataView)); 459Host.Check(retrievedValueColumn.Annotations == valueColumn.Annotations, nameof(valueColumn) + "'s column annotations don't match those of the associated column in " + nameof(dataView));
Utilities\ApplyTransformUtils.cs (1)
98env.Check(oldSource == null || chain == oldSource, "Source data not found in the chain");
Microsoft.ML.Ensemble (12)
EntryPoints\CreateEnsemble.cs (3)
387ch.Check(dataZipEntryNames[i] == entries[i].FullName, errorMsg); 394ch.Check(bytesRead == len, errorMsg); 396ch.Check(buffer[j] == dataSerialized[i][j], errorMsg);
OutputCombiners\BaseStacking.cs (2)
70Host.Check(Meta != null, "Can't save an untrained Stacking combiner"); 132ch.Check(Meta == null, "Train called multiple times");
PipelineEnsemble.cs (2)
165Parent.Host.Check(Mappers[i].InputRoleMappedSchema.Label.HasValue, "Mapper was not trained using a label column"); 443Host.Check(nonHiddenCols == _inputCols.Length,
Selector\FeatureSelector\RandomFeatureSelector.cs (1)
43_host.Check(0 < _args.FeaturesSelectionProportion && _args.FeaturesSelectionProportion < 1,
Selector\SubModelSelector\BaseDiverseSelector.cs (1)
43Host.Check(vm != null, "Predictor doesn't implement the expected interface");
Trainer\EnsembleModelParametersBase.cs (2)
32Host.Check(Utils.Size(models) > 0, "Ensemble was created with no models."); 70Host.Check(predictor != null, "Inner predictor type not compatible with the ensemble type.");
Trainer\EnsembleTrainerBase.cs (1)
188ch.Check(modelSize > 0, "Ensemble training resulted in no valid models.");
Microsoft.ML.EntryPoints (1)
TrainTestSplit.cs (1)
48host.Check(0 < input.Fraction && input.Fraction < 1, "The fraction must be in the interval (0,1).");
Microsoft.ML.FastTree (21)
FastTree.cs (4)
1436ch.Check(slotDropper == null, 1895ch.Check(totalInstances > 0, "All instances skipped due to missing features."); 2935Host.Check(top >= 0, "top must be non-negative"); 2936Host.Check(bottom >= 0, "bottom must be non-negative");
GamModelParameters.cs (8)
195Host.Check(typeof(TIn) == typeof(VBuffer<float>), "Input type does not match."); 196Host.Check(typeof(TOut) == typeof(float), "Output type does not match."); 275Host.Check(0 <= featureIndex && featureIndex < NumberOfShapeFunctions, "Index out of range."); 287Host.Check(0 <= featureIndex && featureIndex < NumberOfShapeFunctions, "Index out of range."); 325Host.Check(0 <= featureIndex && featureIndex < NumberOfShapeFunctions, "Index out of range."); 405Host.Check(typeof(TSrc) == typeof(VBuffer<float>), "Source type does not match."); 406Host.Check(typeof(TDstContributions) == typeof(VBuffer<float>), "Destination type does not match."); 446Host.Check(effects.Length == binThresholds.Length, "Effects array must be same length as binUpperBounds array.");
Training\TreeLearners\LeastSquaresRegressionTreeLearner.cs (1)
248ch.Check(AllowEmptyTrees, "Impossible to perform a leaf split, but the learner was configured to not allow empty trees");
TreeEnsemble\TreeEnsembleCombiner.cs (3)
55_host.Check(calibrated.WeaklyTypedCalibrator is PlattCalibrator, 87_host.Check((calibrated != null) == binaryClassifier, "Ensemble contains both calibrated and uncalibrated models"); 88_host.Check(featureCount == tree.InputType.GetValueCount(), "Found models with different number of features");
TreeEnsembleFeaturizationTransformer.cs (2)
49Host.Check(_featureDetachedColumn.Name == inspectedFeatureColumn.Name, nameErrorMessage); 55Host.Check(_featureDetachedColumn.Type.Equals(inspectedFeatureColumn.Type), typeErrorMessage);
TreeEnsembleFeaturizer.cs (3)
341_ectx.Check(_input.Position >= 0, RowCursorUtils.FetchValueStateError); 418_host.Check(_ensemble != null, "Predictor in model file does not have compatible type"); 770ch.Check(type.Count > 0, "Label must be of known cardinality.");
Microsoft.ML.LightGbm (7)
LightGbmBinaryTrainer.cs (1)
255Host.Check(TrainedEnsemble != null, "The predictor cannot be created before training is complete");
LightGbmMulticlassTrainer.cs (1)
213Host.Check(TrainedEnsemble != null, "The predictor cannot be created before training is complete.");
LightGbmRankingTrainer.cs (1)
283Host.Check(TrainedEnsemble != null, "The predictor cannot be created before training is complete");
LightGbmRegressionTrainer.cs (1)
218Host.Check(TrainedEnsemble != null,
LightGbmTrainerBase.cs (3)
769ch.Check(factory.Data.Schema.Label != null, "The data should have label."); 775ch.Check(factory.Data.Schema.Group != null, "The data for ranking task should have group field."); 803ch.Check(numRow > 0, "Cannot use empty dataset.");
Microsoft.ML.Mkl.Components (8)
OlsLinearRegression.cs (6)
265ch.Check(n > 0, "No training examples in dataset."); 301ch.Check(FloatUtils.IsFinite(beta[i]), "Non-finite values detected in OLS solution"); 357ch.Check(n > 0, "No training examples in dataset."); 407ch.Check(FloatUtils.IsFinite(xty[i]), "Non-finite values detected in OLS solution"); 527ch.Check(FloatUtils.IsFinite(standardErrors[i]), "Non-finite standard error detected from OLS solution"); 530ch.Check(0 <= pValues[i] && pValues[i] <= 1, "p-Value calculated outside expected [0,1] range");
SymSgdClassificationTrainer.cs (1)
213ch.Check(examplesToFeedTrain.Schema.Feature.Value.Type is VectorDataViewType vecType && vecType.Size > 0, "Training set has no features, aborting training.");
VectorWhitening.cs (1)
617Host.Check(src.Length == cslotSrc, "Invalid column size.");
Microsoft.ML.OneDal (1)
OneDalUtils.cs (1)
85channel.Check(n > 0, "No training examples in dataset.");
Microsoft.ML.OnnxConverter (8)
OnnxContextImpl.cs (7)
347_host.Check(dims.Aggregate((x, y) => x * y) == values.Count(), "Number of elements doesn't match tensor size"); 358_host.Check(dims.Aggregate((x, y) => x * y) == values.Count(), "Number of elements doesn't match tensor size"); 369_host.Check(dims.Aggregate((x, y) => x * y) == values.Count(), "Number of elements doesn't match tensor size"); 380_host.Check(dims.Aggregate((x, y) => x * y) == values.Count(), "Number of elements doesn't match tensor size"); 391_host.Check(dims.Aggregate((x, y) => x * y) == values.Count(), "Number of elements doesn't match tensor size"); 402_host.Check(dims.Aggregate((x, y) => x * y) == values.Count(), "Number of elements doesn't match tensor size"); 413_host.Check(dims.Aggregate((x, y) => x * y) == values.Count(), "Number of elements doesn't match tensor size");
SaveOnnxCommand.cs (1)
206ch.Check(variableName != null, "The targeted pipeline can not be fully converted into a well-defined ONNX model. " +
Microsoft.ML.Parquet (3)
ParquetLoader.cs (2)
546Ch.Check(Position >= 0, RowCursorUtils.FetchValueStateError); 617Ch.Check(IsGood, RowCursorUtils.FetchValueStateError);
PartitionedFileLoader.cs (1)
438Ch.Check(IsGood, RowCursorUtils.FetchValueStateError);
Microsoft.ML.Recommender (15)
MatrixFactorizationPredictor.cs (10)
178_host.Check(NumberOfRows > 0, "Number of rows must be positive"); 179_host.Check(NumberOfColumns > 0, "Number of columns must be positive"); 180_host.Check(ApproximationRank > 0, "Number of latent factors must be positive"); 184_host.Check(Utils.Size(_leftFactorMatrix) == NumberOfRows * ApproximationRank, "Unexpected matrix size of a factor matrix (matrix P in LIBMF paper)"); 185_host.Check(Utils.Size(_rightFactorMatrix) == NumberOfColumns * ApproximationRank, "Unexpected matrix size of a factor matrix (matrix Q in LIBMF paper)"); 246_host.Check(typeof(TMatrixColumnIndexIn) == typeof(uint), msg); 249_host.Check(typeof(TMatrixRowIndexIn) == typeof(uint), msg); 252_host.Check(typeof(TOut) == typeof(float), msg); 344_env.Check(Utils.Size(matrixColumnList) == 1, msg); 349_env.Check(Utils.Size(matrixRowList) == 1, msg);
SafeTrainingAndModelBuffer.cs (5)
309ch.Check(nodes.Count > 0, "No valid instances encountered during data loading"); 385_host.Check(_pMFModel != null, "Attempted to get predictor before training"); 387_host.Check(m > 0, "Number of rows should have been positive but was not"); 389_host.Check(n > 0, "Number of columns should have been positive but was not"); 391_host.Check(k > 0, "Internal dimension should have been positive but was not");
Microsoft.ML.StandardTrainers (26)
FactorizationMachine\FactorizationMachineTrainer.cs (3)
431ch.Check(checked(totalFeatureCount * fieldCount * _latentDimAligned) <= Utils.ArrayMaxSize, "Latent dimension or the number of fields too large"); 434ch.Check(predictor.FeatureCount == totalFeatureCount, "Input model's feature count mismatches training feature count"); 435ch.Check(predictor.LatentDimension == _latentDim, "Input model's latent dimension mismatches trainer's");
FactorizationMachine\FieldAwareFactorizationMachineModelParameters.cs (1)
149Host.Check(checked(featureCount * fieldCount * LatentDimAligned) <= Utils.ArrayMaxSize, "Latent dimension too large");
LdSvm\LdSvmTrainer.cs (1)
521Ch.Check(cursor.KeptRowCount > 0, NoTrainingInstancesMessage);
Optimizer\L1Optimizer.cs (1)
207ch.Check(dirDeriv < 0, "L-BFGS chose a non-descent direction.");
Optimizer\Optimizer.cs (1)
390ch.Check(dirDeriv < 0, "L-BFGS chose a non-descent direction.");
Standard\LogisticRegression\LbfgsPredictorBase.cs (2)
539ch.Check(NumGoodRows > 0, NoTrainingInstancesMessage); 642ch.Check(NumGoodRows > 0, NoTrainingInstancesMessage);
Standard\LogisticRegression\MulticlassLogisticRegression.cs (3)
769Host.Check(typeof(TSrc) == typeof(VBuffer<float>), "Invalid source type in GetMapper"); 770Host.Check(typeof(TDst) == typeof(VBuffer<float>), "Invalid destination type in GetMapper"); 784Host.Check(src.Length == NumberOfFeatures, "src length should equal the number of features");
Standard\MulticlassClassification\MetaMulticlassTrainer.cs (1)
131ch.Check(pred != null, "Training did not result in a predictor");
Standard\MulticlassClassification\MulticlassNaiveBayesTrainer.cs (4)
136Host.Check(data.Schema.Label.HasValue, "Missing Label column"); 138Host.Check(labelCol.Type == NumberDataViewType.Single || labelCol.Type is KeyDataViewType, 141Host.Check(data.Schema.Feature.HasValue, "Missing Feature column"); 598Host.Check(src.Length == _featureCount, "Invalid number of features passed.");
Standard\MulticlassClassification\OneVersusAllTrainer.cs (3)
184Host.Check(calibratedModel != null, "Calibrated predictor does not implement the expected interface"); 467Host.Check(saveInSourceCode != null, "Saving in code is not supported."); 486Host.Check(saveInText != null, "Saving in text is not supported.");
Standard\MulticlassClassification\PairwiseCouplingTrainer.cs (1)
321Host.Check(IsValid(vmd, ref inputType), "Predictor doesn't implement the expected interface");
Standard\Online\OnlineLinear.cs (2)
126ch.Check(numFeatures > 0, "Cannot train with zero features!"); 299ch.Check(FloatUtils.IsFinite(maxNorm),
Standard\SdcaBinary.cs (2)
124ch.Check(examplesToFeedTrain.Schema.Feature.Value.Type is VectorDataViewType vecType && vecType.Size > 0, "Training set has no features, aborting training."); 451ch.Check(count > 0, "Training set has 0 instances, aborting training.");
Standard\StochasticTrainerBase.cs (1)
88ch.Check(examplesToFeedTrain.Schema.Feature.Value.Type is VectorDataViewType vecType && vecType.Size > 0, "Training set has no features, aborting training.");
Microsoft.ML.Sweeper (5)
Algorithms\KdoSweeper.cs (1)
235_host.Check(parameterNumeric != null, "KDO sweeper can only sweep over discrete and numeric parameters");
Algorithms\SmacSweeper.cs (2)
310_host.Check(parameterNumeric != null, "SMAC sweeper can only sweep over discrete and numeric parameters"); 465_host.Check(parameterNumeric != null, "SMAC sweeper can only sweep over discrete and numeric parameters");
AsyncSweeper.cs (2)
219_host.Check(!_disposed, "Creating parameters while sweeper is disposed"); 244_host.Check(0 <= id && id < _results.Count, "Invalid index");
Microsoft.ML.TimeSeries (13)
AdaptiveSingularSpectrumSequenceModeler.cs (1)
237_host.Check(trainSize > 2 * windowSize, "The input size for training should be greater than twice the window size.");
SequentialTransformBase.cs (3)
117host.Check(!_isIniatilized, "The window size can be set only once."); 414Ch.Check(column.Index < Schema.Count, nameof(column)); 427Ch.Check(IsColumnActive(column), nameof(column));
SequentialTransformerBase.cs (5)
709Ch.Check(column.Index < Schema.Count, nameof(column)); 722Ch.Check(IsColumnActive(column), nameof(column)); 902Host.Check(onnx.CanSaveOnnx(ctx), "Cannot be saved as ONNX."); 912Host.Check(pfa.CanSavePfa, "Cannot be saved as PFA."); 932Host.Check(input.Schema == Source.Schema, "Schema of input row must be the same as the schema the mapper is bound to");
TrajectoryMatrix.cs (4)
118_ectx.Check(windowSize > 0, "The window length should be greater than 0."); 120_ectx.Check(data.Length >= seriesLength, "The series length cannot be greater than the data length."); 123_ectx.Check(windowSize <= _seriesLength, "The length of the window should be less than or equal to the length of the data."); 137_ectx.Check(Utils.Size(data) >= _seriesLength, "The length of the input series cannot be less than that of the original series.");
Microsoft.ML.Transforms (23)
Dracula\CountTableTransformer.cs (2)
209_host.Check(srcBuffer.Length == cols[i].Type.GetVectorSize(), "value count mismatch"); 616Host.Check((long)valueCount * _parent.Featurizer.NumFeatures < int.MaxValue, "Too large output size");
Dracula\CountTargetEncodingTransformer.cs (1)
147_host.Check(initialCounts.VerifyColumns(columns), nameof(columns));
Dracula\MultiCountTable.cs (9)
80_host.Check(size > 0, "vectors of unknown length are not supported"); 95_host.Check(Utils.Size(inputCols) == n, "Inconsistent number of columns"); 102_host.Check(size == inputCols[i].Type.GetValueCount(), "Inconsistent number of slots"); 145Host.Check(0 <= iCol && iCol < ColCount, nameof(iCol)); 146Host.Check(0 <= iSlot && iSlot < SlotCount[iCol], nameof(iSlot)); 264_host.Check(Utils.Size(inputCols) == table.ColCount, "Inconsistent number of columns"); 265_host.Check(table.SlotCount.Zip(inputCols, (count, col) => (count, col)). 298Host.Check(0 <= iCol && iCol < ColCount, nameof(iCol)); 299Host.Check(0 <= iSlot && iSlot < SlotCount[iCol], nameof(iSlot));
GroupTransform.cs (2)
355_ectx.Check(retrievedColumn.HasValue, errorMessage); 359_ectx.Check(colType is PrimitiveDataViewType, errorMessage);
MissingValueIndicatorTransform.cs (1)
209Host.Check(names.Length == srcVectorType.Size, "Unexpected slot name vector size");
MutualInformationFeatureSelection.cs (2)
138_host.Check(numberOfBins > 1, "numBins must be greater than 1."); 267host.Check(options.NumBins > 1, "numBins must be greater than 1.");
PermutationFeatureImportance.cs (1)
40host.Check(topExamples > 0, "Provide how many examples to use (positive number) or set to null to use whole dataset.");
RandomFourierFeaturizing.cs (1)
551Host.Check(src.Length == transformInfo.SrcDim, "column does not have the expected dimensionality.");
SvmLight\SvmLightLoader.cs (2)
474Ch.Check(IsGood, "cannot call getter with cursor in its current state"); 496Ch.Check(IsGood, "Cannot call ID getter in current state");
UngroupTransform.cs (2)
623Ch.Check(result != null, "Unexpected getter type requested"); 641Ch.Check(Input.Position >= 0, RowCursorUtils.FetchValueStateError);