machine-learning-integration

1.0.2 • Public • Published

Machine Learning Integration Package

A simple JavaScript package for machine learning integration, allowing you to train and use machine learning models within your applications.

Installation

npm install ml-integration

Usage

const MachineLearningIntegration = require('ml-integration');

// Create an instance of the MachineLearningIntegration class
const mlIntegration = new MachineLearningIntegration();

// Example training data
const trainingData = [
  { input: [1], output: 2 },
  { input: [2], output: 4 },
  { input: [3], output: 6 },
];

// Train the model
mlIntegration.trainModel(trainingData);

// Save the trained model to a file
mlIntegration.saveModelToFile('trained-model.json');

// Load the model from a file
mlIntegration.loadModelFromFile('trained-model.json');

// Make a prediction
const prediction = mlIntegration.predict([4]);
console.log('Prediction:', prediction);

API

MachineLearningIntegration()

Creates a new instance of the MachineLearningIntegration class.

trainModel(trainingData)

Trains the machine learning model with the provided training data.

  • trainingData: An array of { input, output } pairs.

saveModelToFile(filename)

Saves the trained model to a JSON file.

  • filename: The name of the file to save the model.

loadModelFromFile(filename)

Loads a trained model from a JSON file.

  • filename: The name of the file containing the model.

predict(input)

Makes a prediction using the trained model.

  • input: The input data for making predictions.

Package Sidebar

Install

npm i machine-learning-integration

Weekly Downloads

3

Version

1.0.2

License

MIT

Unpacked Size

3.96 kB

Total Files

3

Last publish

Collaborators

  • honcharov404