0.2.0 • Published 2 years ago

ml-pipe v0.2.0

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

ml-pipe

NPM version build status Test coverage npm download

Orchestrate ML pipelines. One design different to sklearn pipelines is that our transformers can have the attribute onTarget for use in Pipelines. There, it can be convenient and to simply add a target transformation as a step into the Pipeline

Installation

$ npm i ml-pipe

Usage

import { trainTestSplit } from 'ml-pipe/modelSelection/trainTestSplit';
import {Pipeline} from 'ml-pipe/pipeline';
import {FCNN} from 'ml-pipe/estimators/neuralNetwork/fcnn'
import {StandardScaler, TargetStandardScaler} from 'ml-pipe/transformers/preprocessing/standardScaler'
import {meanSquaredError} from 'ml-pipe/metrics/regression'
const {xTrain, xTest, yTrain, yTest} = trainTestSplit(x, y, 
    {trainFraction: 0.8,  stratify: yBinned})


const pipe = new Pipeline([
    ('xScale', new StandardScaler()),
    ('yScale', new TargetStandardScaler()),
    ('model', new FCNN({inputSize: 5}))
])

await pipe.fit(XTrain, yTrain)
const predictionsTest = pipe.predict(xTest)
const mse = meanSquaredError(predictionsTest, yTest)

Related package:

License

MIT