public ManyToOneDataTableAdaptor(ILinearAlgebraProvider lap, IDataTable dataTable) : base(lap, dataTable) { if (_dataColumnIndex.Count() > 1) { throw new NotImplementedException("Sequential datasets not supported with more than one input data column"); } _rowDepth = new int[dataTable.RowCount]; FloatMatrix inputMatrix = null; FloatVector outputVector = null; dataTable.ForEach((row, i) => { inputMatrix = row.GetField <FloatMatrix>(_dataColumnIndex[0]); outputVector = row.GetField <FloatVector>(_dataTargetIndex); _rowDepth[i] = inputMatrix.RowCount; if (inputMatrix.ColumnCount != outputVector.Size) { throw new ArgumentException("Rows between input and output data tables do not match"); } }); _inputSize = inputMatrix.ColumnCount; _outputSize = outputVector.Size; }
void _Initialise(IDataTable dataTable) { _rowDepth = new int[dataTable.RowCount]; FloatMatrix inputMatrix = null, outputMatrix = null; dataTable.ForEach((row, i) => { inputMatrix = row.GetField <FloatMatrix>(0); outputMatrix = row.GetField <FloatMatrix>(1); _rowDepth[i] = outputMatrix.RowCount; }); _inputSize = inputMatrix.ColumnCount; _outputSize = outputMatrix.ColumnCount; }
public TableInfo(IDataTable table) { _classColumnIndex = table.TargetColumnIndex; for (int i = 0, len = table.ColumnCount; i < len; i++) { if (i != _classColumnIndex) { var column = table.Columns[i]; if (column.IsContinuous) _continuous.Add(i); else if (ColumnTypeClassifier.IsCategorical(column)) _categorical.Add(i); } } table.ForEach(row => _data.Add(new InMemoryRow(row, _categorical, _continuous, _classColumnIndex))); }
public RowClassifier(ILinearAlgebraProvider lap, IRowClassifier classifier, IDataTable dataTable, IDataTableAnalysis analysis, string name = null) : base(name) { _lap = lap; _classifier = classifier; _targetLabel = analysis.ColumnInfo .First(ci => dataTable.Columns[ci.ColumnIndex].IsTarget) .DistinctValues .Select((v, i) => (v.ToString(), i)) .ToDictionary(d => d.Item1, d => d.Item2) ; // read the entire data table into memory dataTable.ForEach(row => _data.Add(row)); }
/// <inheritdoc /> protected RowBasedDataTableAdaptorBase(ILinearAlgebraProvider lap, IDataTable dataTable) : base(lap, dataTable) { // read the entire data table into memory dataTable.ForEach(row => _data.Add(row)); }