MulticlassClassificationExperiment preFeaturizer not acting on the schema

オープン
#7,522 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
35/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
csharp

調査の方向性

まず、MulticlassClassificationExperiment.Execute を追跡し、スキーマ検証中にその preFeaturizer がどのように処理されるかを確認します。提供されている MulticlassExperimentSettings の例を使用して、DropColumns と CustomMapping で問題を再現します。preFeaturizer の結果のスキーマが検証に使用され、トレーニングと予測を通じて変換が正しく保持されれば完了です。

索引モデルが issue の本文から書いたものです。

説明

area-AutoML bug yellow

System Information (please complete the following information):

  • OS & Version: Windows 11
  • ML.NET Version: ML.NET v4.0.2 & Auto ML.NET v0.22.2
  • .NET Version: .NET 10

Describe the bug
When using a transform like DropColumns or CustomMapping the resulting transform is not taken into account as the new schema. This causes Schema validation errors with our even applying the transforms. For instance, with the following code applied outside of the will work when passed outside of the preFeaturizer, but when used as an input it fails saying it cannot find the column. If a custom mapper is used the reverse problems happen where an output schema is not seen and the columns type is rejected.
"csharp var transformedData = ctx.Transforms.DropColumns([HybridClassifierInputModel.imageSource]).Fit(fullData).Transform(fullData);"

This will also result in errors after training where you will need to manually apply the transform before the predictor.

To Reproduce
Steps to reproduce the behavior:

  1. Create a IDataView with a schema
  2. Set up an experiment for the MulticlassExperimentSettings
  3. Try any preFeaturizer where you would drop a column or try to change the schema too much. DropColumns or SelectColumns are perfect examples

Expected behavior
I would expect the transformer in preFeaturizer to be applied before the validation. Thus, it would allow for column drops or when working with data that must be massaged, or you are using in multiple ways.

Screenshots, Code, Sample Projects

MulticlassExperimentSettings textModelSettings = new MulticlassExperimentSettings()
{
	OptimizingMetric = OptimizingMetric,
	MaxExperimentTimeInSeconds = maxTrainTimeInSeconds,
	//CacheBeforeTrainer = CacheBeforeTrainer.On,
	CacheDirectoryName = Environment.CurrentDirectory, // Skip the disk and store in-memory
};

//var transformedData = ctx.Transforms.DropColumns([HybridClassifierInputModel.imageSource]).Fit(fullData).Transform(fullData);
MulticlassClassificationExperiment experiment = ctx.Auto().CreateMulticlassClassificationExperiment(textModelSettings);

TrainTestData trainValidationData = ctx.Data.TrainTestSplit(ctx.Data.ShuffleRows(transformedData), testFraction: 0.2);

ExperimentResult <MulticlassClassificationMetrics> result = experiment.Execute(trainData: trainValidationData.TrainSet,
								//preFeaturizer: ctx.Transforms.CustomMapping<HybridClassifierInputModel, TextClassifierInputModel>(HybridToTextCustomAction.CustomAction, nameof(HybridToTextCustomAction), outputSchemaDefinition: SchemaDefinition.Create(typeof(TextClassifierInputModel))),
								preFeaturizer: ctx.Transforms.DropColumns([HybridClassifierInputModel.imageSource]),
								validationData: trainValidationData.TestSet,
								labelColumnName: HybridClassifierInputModel.target,
								progressHandler: new TextCPUMlClassifierProgressHandler<IHybridMlClassifierService>(Logger)); 

Additional context
I would have like to use the data to train more than one model, but it needs some small data changes for either one. I have a custom IDataView that attaches to a DbLite. It would be good if the preFeature worked so that it could stream the data.

主要言語
C#
スター
9.4k
フォーク
2k
平均マージ
2日 18時間
マージ済み PR(30日)
64

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

dotnet/machinelearning のほかの issue

dotnet/machinelearning の issue をすべて見る

似ている issue

C# の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。