dotnet / dotnet/machinelearning
DropSlot transform is needed
- Dominant language
- C#
- Stars
- 9.4k
- Forks
- 2k
- Avg merge
- 2d 20h
- Merged PRs (30d)
- 11
Description
Consider this code snippet:
```
var defaultPipeline = ml.Transforms.Text.FeaturizeText("TextFeatures", "Text")
.Append(ml.Transforms.ProjectToPrincipalComponents("PC", "TextFeatures", null, 10))
.Append(ml.Transforms.DropSlots("ShortenedPC", "PC", new int[] { 0, 1})) // drop slots 0 & 1
```
Currently its not possible bcs SlotDroppingTransform is not exposed. The workaround is to use CustomMapping which is bit cumbersome.
```
public class InputRow
{
[VectorType(10)]
public float[] PC;
}
public class OutputRow
{
[VectorType(8)]
public float[] PCA = new float[8];
}
...
Action mapping =
(input, output) => Array.Copy(input.PC, 2, output.PCA, 0, 8);
var defaultPipeline = ml.Transforms.Text.FeaturizeText("TextFeatures", "Text")
.Append(ml.Transforms.ProjectToPrincipalComponents("PC", "TextFeatures", null, 10))
.Append(ml.Transforms.CustomMapping(mapping, null))
Contributor guide
Assessment
This issue has not been assessed yet.