220 references to Check
Microsoft.Data.Analysis.Tests (2)
test\Microsoft.ML.TestFramework\GlobalBase.cs (2)
26Contracts.Check(prev == null, "Expected to replace null assertion handler!"); 65Contracts.Check(prev == AssertHandler, "Expected to replace Global.AssertHandler!");
Microsoft.ML.AutoML (3)
API\AutoCatalog.cs (3)
646Contracts.Check(outputColumnNames.Count() == inputColumnNames.Count() && outputColumnNames.Count() > 0, "outputColumnNames and inputColumnNames must have the same length and greater than 0"); 667Contracts.Check(outputColumnNames.Count() == inputColumnNames.Count() && outputColumnNames.Count() > 0, "outputColumnNames and inputColumnNames must have the same length and greater than 0"); 686Contracts.Check(outputColumnNames.Count() == inputColumnNames.Count() && outputColumnNames.Count() > 0, "outputColumnNames and inputColumnNames must have the same length and greater than 0");
Microsoft.ML.Core (42)
CommandLine\CmdParser.cs (3)
1488Contracts.Check(!IsCollection || AllowMultiple, "Collection arguments must allow multiple"); 1489Contracts.Check(!Unique || IsCollection, "Unique only applicable to collection arguments"); 1545Contracts.Check(_signatureType != null, "ComponentFactory Arguments need a SignatureType set.");
ComponentModel\LoadableClassAttribute.cs (1)
209Contracts.Check(sigType.BaseType == typeof(System.MulticastDelegate), "LoadableClass signature type must be a delegate type");
Data\AnnotationUtils.cs (1)
381Contracts.Check(colIndex >= 0, nameof(colIndex));
Data\IEstimator.cs (1)
89Contracts.Check(source.IsValid, nameof(source));
Data\ModelHeader.cs (1)
643Contracts.Check(Utils.Size(modelSignature) == 8, "Model signature must be eight characters");
EntryPoints\ModuleArgs.cs (14)
165Contracts.Check(_inf == null, 167Contracts.Check(_max == null || ((IComparable)_max).CompareTo(value) != -1, 169Contracts.Check(_sup == null || ((IComparable)_sup).CompareTo(value) == 1, 184Contracts.Check(_sup == null, 186Contracts.Check(_min == null || ((IComparable)_min).CompareTo(value) != 1, 188Contracts.Check(_inf == null || ((IComparable)_inf).CompareTo(value) == -1, 203Contracts.Check(_min == null, 205Contracts.Check(_max == null || ((IComparable)_max).CompareTo(value) == 1, 207Contracts.Check(_sup == null || ((IComparable)_sup).CompareTo(value) == 1, 222Contracts.Check(_max == null, 224Contracts.Check(_min == null || ((IComparable)_min).CompareTo(value) == -1, 226Contracts.Check(_inf == null || ((IComparable)_inf).CompareTo(value) == -1, 237Contracts.Check(val is IComparable, "Type for range attribute must support IComparable"); 241Contracts.Check(_type == val.GetType(), "All Range attribute values must be of the same type");
Utilities\HybridMemoryStream.cs (8)
156Contracts.Check(!_disposed, "Stream already disposed"); 163Contracts.Check(_memStream.CanRead, "attempt to perform operation on closed stream"); 189Contracts.Check(!_disposed, "Stream already disposed"); 199Contracts.Check(!_disposed, "Stream already disposed"); 206Contracts.Check(!_disposed, "Stream already disposed"); 213Contracts.Check(!_disposed, "Stream already disposed"); 226Contracts.Check(!_disposed, "Stream already disposed"); 233Contracts.Check(!_disposed, "Stream already disposed");
Utilities\MathUtils.cs (1)
61Contracts.Check(x.Length == y.Length, "Input and output must be same length.");
Utilities\MinWaiter.cs (2)
78Contracts.Check(_maxWaiters > 0, "All waiters have been retired, Wait should not be called at this point"); 102Contracts.Check(_maxWaiters > 0, "Attempt to retire more waiters than were initially declared");
Utilities\ReservoirSampler.cs (2)
164Contracts.Check(!_locked, "Cannot continue to sample after Lock() has been called"); 248Contracts.Check(_locked, "Call Lock() before the call to GetSample()");
Utilities\Stats.cs (2)
29Contracts.Check(rangeSize <= (long)int.MaxValue * int.MaxValue, 128Contracts.Check(alphas.Length == result.Length,
Utilities\Utils.cs (1)
770Contracts.Check(schema.Count > 0, nameof(schema));
Utilities\VBufferUtils.cs (5)
115Contracts.Check(a.Length == b.Length, "Vectors must have the same dimensionality."); 166Contracts.Check(a.Length == b.Length, "Vectors must have the same dimensionality."); 591Contracts.Check(src.Length == dst.Length, "Vectors must have the same dimensionality."); 878Contracts.Check(src.Length == dst.Length, "Vectors must have the same dimensionality."); 1169Contracts.Check(a.Length == b.Length, "Vectors must have the same dimensionality.");
Microsoft.ML.Data (83)
Data\Conversion.cs (12)
489Contracts.Check(type.RawType == typeof(TSrc), "Wrong TSrc type argument"); 543Contracts.Check(typeDst.RawType == typeof(TDst), "Wrong TDst type parameter"); 1227Contracts.Check((I1)res == res, "Overflow or underflow occurred while converting value in text to sbyte."); 1246Contracts.Check((I2)res == res, "Overflow or underflow occurred while converting value in text to short."); 1265Contracts.Check((I4)res == res, "Overflow or underflow occurred while converting value in text to int."); 1454Contracts.Check(res.HasValue, "Value could not be parsed from text to sbyte."); 1455Contracts.Check((I1)res == res, "Overflow or underflow occurred while converting value in text to sbyte."); 1462Contracts.Check(res.HasValue, "Value could not be parsed from text to short."); 1463Contracts.Check((I2)res == res, "Overflow or underflow occurred while converting value in text to short."); 1470Contracts.Check(res.HasValue, "Value could not be parsed from text to int."); 1471Contracts.Check((I4)res == res, "Overflow or underflow occurred while converting value in text to int."); 1478Contracts.Check(res.HasValue, "Value could not be parsed from text to long.");
Data\DataViewUtils.cs (3)
54Contracts.Check(n > 0, "n"); 972Contracts.Check(_index < _count, "Cannot get value as the cursor is not in a good state"); 986Contracts.Check(_index < _count, "Cannot get value as the cursor is not in a good state");
Data\RowCursorUtils.cs (5)
62Contracts.Check(typeSrc is PrimitiveDataViewType, "Source column type must be primitive"); 83Contracts.Check(typeSrc is PrimitiveDataViewType, "Source column type must be primitive"); 128Contracts.Check(typeSrc is PrimitiveDataViewType, "Source column type must be primitive"); 161Contracts.Check(typeSrc != null, "Source column type must be vector"); 181Contracts.Check(typeSrc != null, "Source column type must be vector");
DataLoadSave\Binary\BinaryLoader.cs (1)
1953Contracts.Check(_curr != null, RowCursorUtils.FetchValueStateError);
DataLoadSave\Binary\CodecFactory.cs (1)
131Contracts.Check(mem.Length == output, "codec description length did not match stream length");
DataLoadSave\Binary\Codecs.cs (6)
327Contracts.Check(_builder != null, "writer was already committed"); 334Contracts.Check(_builder != null, "writer already committed"); 378Contracts.Check(++_index < _entries, "reader already read all values"); 738Contracts.Check(++_index < _entries, "reader already read all values"); 853Contracts.Check(_valuesStream != null, "writer already committed"); 908Contracts.Check(_valuesStream != null, "writer already committed");
DataLoadSave\Text\TextSaver.cs (1)
171Contracts.Check(_slotNames.Length == typeNames.Size, "Unexpected slot names length");
DataLoadSave\TransformerChain.cs (1)
243Contracts.Check(((ITransformer)this).IsRowToRowMapper, nameof(ITransformer.GetRowToRowMapper) + " method called despite " +
DataLoadSave\Transpose\TransposeLoader.cs (1)
183Contracts.Check(stream.Position == _offset, "Unexpected position on substream");
DataView\CacheDataView.cs (4)
777Contracts.Check(_curr >= 0, "Cannot call ID getter in current state"); 842Contracts.Check(_curr >= 0, "Cannot call ID getter in current state"); 978Contracts.Check(_curr >= 0, "Cannot call ID getter in current state"); 1084Contracts.Check(_curr >= 0, "Cannot call ID getter in current state");
Deprecated\Vector\VBufferMathUtils.cs (4)
141Contracts.Check(src.Length == dst.Length, "Vectors must have the same dimensionality."); 169Contracts.Check(src.Length == dst.Length, "Vectors must have the same dimensionality."); 194Contracts.Check(src.Length == dst.Length, "Vectors must have the same dimensionality."); 224Contracts.Check(a.Length == b.Length, "Vectors must have the same dimensionality.");
Deprecated\Vector\VectorUtils.cs (11)
25Contracts.Check(Utils.Size(a) == Utils.Size(b), "Arrays must have the same length"); 32Contracts.Check(Utils.Size(a) == b.Length, "Vectors must have the same dimensionality."); 43Contracts.Check(a.Length == b.Length, "Vectors must have the same dimensionality."); 162Contracts.Check(a.Length == dst.Length, "Vectors must have the same dimensionality."); 254Contracts.Check(b.Length <= a.Length - offset, "VBuffer b must be no longer than a.Length - offset."); 306Contracts.Check(b.Length <= a.Length - offset, "VBuffer b must be no longer than a.Length - offset."); 396Contracts.Check(a.Length == b.Length, "Vectors must have the same dimensionality."); 417Contracts.Check(Utils.Size(a) == b.Length, "Vectors must have the same dimensionality."); 472Contracts.Check(src.Length <= dst.Length - offset, "Vector src must be no longer than dst.Length - offset."); 499Contracts.Check(src.Length == dst.Length, "Arrays must have the same dimensionality."); 543Contracts.Check(a.Length == b.Length, "Arrays must have the same dimensionality.");
Dirty\ChooseColumnsByIndexTransform.cs (2)
95Contracts.Check(sources.Length > 0, "Choose columns by index has no output column."); 113Contracts.Check(selectedIndex < _sourceSchema.Count, fmt);
Dirty\IniFileUtils.cs (1)
42Contracts.Check(match.Success, "Unable to retrieve number of evaluators from ini");
Evaluators\AucAggregator.cs (1)
114Contracts.Check(PosSample != null && NegSample != null, "Must call Finish() before computing AUC");
Evaluators\EvaluatorUtils.cs (1)
331Contracts.Check(!foundRow, "Multiple metric rows found in metrics data view.");
Evaluators\QuantileRegressionEvaluator.cs (2)
140Contracts.Check(score.Length == TotalL1Loss.Length, "Vectors must have the same dimensionality."); 172Contracts.Check(loss.Length == TotalL1Loss.Length, "Vectors must have the same dimensionality.");
Evaluators\RankingEvaluator.cs (1)
509Contracts.Check(weight == _currentQueryWeight, "Weights within query differ");
Scorers\GenericScorer.cs (1)
80Contracts.Check(rowMapper != null, "Predictor expected to be a RowMapper!");
Scorers\MulticlassClassificationScorer.cs (2)
215Contracts.Check(((ICanSavePfa)this).CanSavePfa, "Cannot be saved as PFA"); 224Contracts.Check(((ICanSaveOnnx)this).CanSaveOnnx(ctx), "Cannot be saved as ONNX.");
Scorers\SchemaBindablePredictorWrapper.cs (4)
477Contracts.Check(ScoreType == NumberDataViewType.Single, "Expected predictor result type to be float"); 486Contracts.Check(distMapper.InputType is VectorDataViewType vectorType && vectorType.ItemType == NumberDataViewType.Single, 488Contracts.Check(distMapper.DistType == NumberDataViewType.Single, 529Contracts.Check(typeSrc is VectorDataViewType vectorType
Training\TrainerUtils.cs (2)
312Contracts.Check(schema.Schema == row.Schema, "schemas don't match!"); 333Contracts.Check(schema.Schema == row.Schema, "schemas don't match!");
Transforms\MetadataDispatcher.cs (11)
107Contracts.Check(type.RawType == typeof(TValue), "Incompatible types"); 129Contracts.Check(type.RawType == typeof(TValue), "Incompatible types"); 161Contracts.Check(!_sealed, "MetadataDispatcher sealed"); 162Contracts.Check(schemaSrc == null || (0 <= indexSrc && indexSrc < schemaSrc.Count), "indexSrc out of range"); 163Contracts.Check(filterSrc == null || schemaSrc != null, "filterSrc should be null if schemaSrc is null"); 174Contracts.Check(!_sealed, "MetadataDispatcher sealed"); 206Contracts.Check(_sealed, "MetadataDispatcher not sealed"); 252Contracts.Check(_sealed, "MetadataDispatcher not sealed"); 400Contracts.Check(tmp == null, "Duplicate building of metadata"); 409Contracts.Check(_md != null, "Builder disposed"); 425Contracts.Check(_md != null, "Builder disposed");
Transforms\NormalizeColumnSng.cs (2)
570Contracts.Check(Elements.Count > 0, "Cannot peek with 0 elements"); 577Contracts.Check(Elements.Count > 0, "Cannot pop with 0 elements");
Utils\SequencePool.cs (3)
237Contracts.Check(_start.Length != Utils.ArrayMaxSize, "Cannot allocate memory for the sequence pool"); 247Contracts.Check(_next.Length != Utils.ArrayMaxSize, "Cannot allocate memory for the sequence pool"); 259Contracts.Check(_bytes.Length != Utils.ArrayMaxSize, "Cannot allocate memory for the sequence pool");
Microsoft.ML.Ensemble (2)
OutputCombiners\BaseStacking.cs (2)
91Contracts.Check(Meta != null, "Training of stacking combiner not complete"); 116Contracts.Check(ivm != null, "Stacking predictor doesn't implement the expected interface");
Microsoft.ML.EntryPoints (3)
PermutationFeatureImportance.cs (3)
65Contracts.Check(roleMappedData.Schema.Feature != null, "Feature column not found."); 66Contracts.Check(roleMappedData.Schema.Label != null, "Label column not found."); 257Contracts.Check(roleMappedData.Schema.Group != null, "Group ID column not found.");
Microsoft.ML.FastTree (16)
Dataset\Dataset.cs (4)
504Contracts.Check(Ratings != null && Boundaries != null && QueryIds != null && DocIds != null && MaxDcg != null, 507Contracts.Check(Ratings.Length == DocIds.Length, "Length of label array does not match length of docID array"); 508Contracts.Check(Boundaries.Length == QueryIds.Length + 1, "Length of boundaries array does not match length of queryID array"); 509Contracts.Check(Utils.Size(MaxDcg) == 0 || Utils.Size(MaxDcg[0]) == QueryIds.Length, "Length of MaxDCG does not match number of queries");
FastTree.cs (2)
842Contracts.Check(st != null, "unknown dataset passed to ConstructScoreTracker"); 868Contracts.Check(scores.Length == initScores.Length, "Length of initscores and scores mismatch");
FastTreeClassification.cs (1)
358Contracts.Check(_nneg > 0 && _npos > 0, "Only one class in training set.");
FastTreeRanking.cs (2)
698Contracts.Check(0 <= order[i] && order[i] < numDocuments, "the index to document exceeds range"); 710Contracts.Check(2 <= group && group < numDocuments + 2, "dupeId group exceeds range");
RandomForestRegression.cs (1)
57Contracts.Check(weights == null || weights.Length == data.Length, "weights");
Training\Test.cs (3)
348Contracts.Check(scoreTracker.Dataset.NumDocs == labels.Length, "Mismatch between dataset and labels"); 528Contracts.Check(scoreTracker.Dataset.NumDocs == _labels.Length, "Mismatch between dataset and labels"); 602Contracts.Check(scoreTracker.Dataset.NumDocs == binaryLabels.Length, "Mismatch between dataset and labels");
TreeEnsemble\InternalQuantileRegressionTree.cs (2)
81Contracts.Check(sampleCount == _labelsDistribution.Length / NumLeaves, "Bad quantile sample count"); 82Contracts.Check(_instanceWeights == null || sampleCount == _instanceWeights.Length / NumLeaves, "Bad quantile weight count");
TreeEnsemble\InternalRegressionTree.cs (1)
223CheckValid(Contracts.Check);
Microsoft.ML.KMeansClustering (1)
KMeansPlusPlusTrainer.cs (1)
1840Contracts.Check(centroid.Items().Select(x => x.Value).All(FloatUtils.IsFinite), "Model training failed: non-finite coordinates are generated");
Microsoft.ML.LightGbm (1)
LightGbmArguments.cs (1)
346Contracts.Check(options.TopRate + options.OtherRate <= 1, "Sum of topRate and otherRate cannot be larger than 1.");
Microsoft.ML.OnnxConverter (1)
OnnxUtils.cs (1)
256Contracts.Check(false, msg);
Microsoft.ML.PCA (1)
PcaTrainer.cs (1)
333Contracts.Check(n > 0, "Empty training data");
Microsoft.ML.StandardTrainers (16)
Optimizer\LineSearch.cs (1)
426Contracts.Check(initDeriv < 0, "Cannot search in direction of ascent!");
Optimizer\SgdOptimizer.cs (2)
168Contracts.Check(FloatUtils.IsFinite(initial.GetValues()), "The initial vector contains NaNs or infinite values."); 365Contracts.Check(FloatUtils.IsFinite(initial.GetValues()), "The initial vector contains NaNs or infinite values.");
Standard\LinearModelParameters.cs (2)
331Contracts.Check(type == models[0].GetType(), "Submodel for parameter mixer has the wrong type"); 341Contracts.Check(type == m.GetType(), "Submodel for parameter mixer has the wrong type");
Standard\LogisticRegression\LbfgsPredictorBase.cs (4)
900Contracts.Check(i < BiasCount, classError); 903Contracts.Check(i == BiasCount, classError); 908Contracts.Check(i < initWeights.Length, featError); 911Contracts.Check(i == initWeights.Length, featError);
Standard\LogisticRegression\LogisticRegression.cs (1)
207Contracts.Check(!float.IsNaN(datumLoss), "Unexpected NaN");
Standard\LogisticRegression\MulticlassLogisticRegression.cs (1)
276Contracts.Check(FloatUtils.IsFinite(datumLoss), "Data contain bad values.");
Standard\MulticlassClassification\OneVersusAllTrainer.cs (3)
612Contracts.Check(IsValid(vm, ref inputType), "Predictor doesn't implement the expected interface"); 696Contracts.Check(IsValid(vm, ref inputType), "Predictor doesn't implement the expected interface"); 861Contracts.Check(IsValid(vm, ref inputType), "Predictor doesn't implement the expected interface");
Standard\Online\AveragedLinear.cs (1)
317Contracts.Check(!options.LazyUpdate || !options.RecencyGainMultiplicative && options.RecencyGain == 0, "Cannot have both recency gain and lazy updates.");
Standard\Online\OnlineLinear.cs (1)
216Contracts.Check(NumIterExamples > 0, NoTrainingInstancesMessage);
Microsoft.ML.Sweeper (14)
Parameters.cs (14)
221Contracts.Check(options.Min < options.Max, "min must be less than max"); 223Contracts.Check(!options.LogBase || options.Min > 0, "min must be positive if log scale is used"); 224Contracts.Check(!options.LogBase || options.StepSize == null || options.StepSize > 1, "StepSize must be greater than 1 if log scale is used"); 225Contracts.Check(options.LogBase || options.StepSize == null || options.StepSize > 0, "StepSize must be greater than 0 if linear scale is used"); 316Contracts.Check(valueTyped != null, "LongValueGenerator could not normalized parameter because it is not of the correct type"); 317Contracts.Check(_options.Min <= valueTyped.Value && valueTyped.Value <= _options.Max, "Value not in correct range"); 331Contracts.Check(valueTyped != null, "Parameter should be of type LongParameterValue"); 353Contracts.Check(options.Min < options.Max, "min must be less than max"); 355Contracts.Check(!options.LogBase || options.Min > 0, "min must be positive if log scale is used"); 356Contracts.Check(!options.LogBase || options.StepSize == null || options.StepSize > 1, "StepSize must be greater than 1 if log scale is used"); 357Contracts.Check(options.LogBase || options.StepSize == null || options.StepSize > 0, "StepSize must be greater than 0 if linear scale is used"); 440Contracts.Check(valueTyped != null, "FloatValueGenerator could not normalized parameter because it is not of the correct type"); 441Contracts.Check(_options.Min <= valueTyped.Value && valueTyped.Value <= _options.Max, "Value not in correct range"); 455Contracts.Check(valueTyped != null, "Parameter should be of type FloatParameterValue");
Microsoft.ML.TensorFlow (5)
TensorflowUtils.cs (5)
264Contracts.Check(env != null, nameof(env)); 273Contracts.Check(env != null, nameof(env)); 287Contracts.Check(env != null, nameof(env)); 323Contracts.Check(env != null, nameof(env)); 401Contracts.Check(env != null, nameof(env));
Microsoft.ML.TestFramework (4)
BaseTestPredictorsMaml.cs (1)
328Contracts.Check(dataset.testSettings == null, "Separate test loader pipeline is not supported");
GlobalBase.cs (2)
26Contracts.Check(prev == null, "Expected to replace null assertion handler!"); 65Contracts.Check(prev == AssertHandler, "Expected to replace Global.AssertHandler!");
Learners.cs (1)
43Contracts.Check(ok, "Missing assemblies!");
Microsoft.ML.TimeSeries (10)
AdaptiveSingularSpectrumSequenceModeler.cs (2)
1504Contracts.Check(forecast.CanComputeForecastIntervals, "The forecast intervals cannot be computed for this forecast object."); 1509Contracts.Check(sdForecast.Length >= horizon, "The forecast standard deviation values are not available.");
EigenUtils.cs (1)
515Contracts.Check(Utils.Size(input) >= n2, "The input matrix must at least have " + n2 + " elements");
FftUtils.cs (4)
226Contracts.Check(inputRe.Length >= length && inputIm.Length >= length && outputRe.Length >= length && outputIm.Length >= length, 271Contracts.Check(inputRe.Length >= length && inputIm.Length >= length && outputRe.Length >= length && outputIm.Length >= length, 328Contracts.Check(inputRe.Length >= length && inputIm.Length >= length && outputRe.Length >= length && outputIm.Length >= length, 373Contracts.Check(inputRe.Length >= length && inputIm.Length >= length && outputRe.Length >= length && outputIm.Length >= length,
PredictionEngine.cs (1)
239Contracts.Check(IsRowToRowMapper(InputTransformer), nameof(GetRowToRowMapper) +
TimeSeriesUtils.cs (2)
16Contracts.Check(queue != null, nameof(queue)); 45Contracts.Check(queue != null, nameof(queue));
Microsoft.ML.Transforms (16)
Dracula\CMCountTable.cs (6)
57Contracts.Check(Depth > 0, "depth must be positive"); 58Contracts.Check(tables.All(x => Utils.Size(x) == Depth), "Depth must be the same for all labels"); 61Contracts.Check(Width > 0, "width must be positive"); 62Contracts.Check(tables.All(t => t.All(t2 => t2.Max(kvp => kvp.Key) < Width)), "Keys must be between 0 and Width - 1"); 199Contracts.Check(0 < depth && depth < DepthLim, "Depth out of range"); 200Contracts.Check(0 < width, "Width out of range");
Dracula\CountTable.cs (2)
49Contracts.Check(0 < labelCardinality && labelCardinality < LabelCardinalityLim, "Label cardinality out of bounds"); 53Contracts.Check(garbageThreshold >= 0, "Garbage threshold must be non-negative");
Dracula\DictCountTable.cs (2)
51Contracts.Check(counts.Length == labelCardinality, "Counts must be parallel to label cardinality"); 52Contracts.Check(counts.All(x => x != null), "Count dictionaries must all exist");
Dracula\Featurizer.cs (1)
127Contracts.Check(Utils.Size(classNames) == _labelBinCount, "incorrect class names");
Dracula\MultiCountTable.cs (1)
381Contracts.Check(baseCountTable.GarbageThreshold == 0, "Garbage bin not supported for shared table");
Expression\MethodGenerator.cs (1)
145Contracts.Check(Il != null, "Cannot access IL for a method that has already been created");
GroupTransform.cs (1)
417Contracts.Check(result = false, "Invalid type.");
SvmLight\SvmLightLoader.cs (1)
366Contracts.Check(keys.Length == values.Length, "number of keys does not match number of values.");
Text\WordBagTransform.cs (1)
554Contracts.Check(Utils.Size(cols[i].Source) == 1, "too many source columns");