npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

resonance-ml

v1.0.3

Published

A lightweight Resonance Frequency Classifier machine learning algorithm.

Readme

Resonance-ML

A lightweight, simple Machine Learning classifier based on resonance frequency + cosine similarity. This package allows developers to train models using a CSV dataset and predict outcomes based on input features.


Features

  • Train your ML model using a CSV file.
  • Select columns for training and output class.
  • Predict using user input.
  • Extremely fast and lightweight.
  • Works in React, Node.js, Express, and browser.js apps.

Installation

npm install resonance-ml

Project Structure

resonance-ml/
│
├── package.json
├── index.js
├── README.md
├── src/
│   └── ResonanceFrequencyClassifier.js

Quick Example (Node.js)

import { ResonanceFrequencyClassifier } from "resonance-ml";

const classifier = new ResonanceFrequencyClassifier();

// Training data
const trainingData = [
  { height: 170, weight: 65, gender: "male" },
  { height: 160, weight: 55, gender: "female" }
];

classifier.train(trainingData, ["height", "weight"], "gender");

// Prediction
const result = classifier.predict({ height: 168, weight: 62 });
console.log(result);

Usage in React + CSV Upload

Example UI flow:

  1. User uploads CSV file
  2. User selects training columns
  3. User selects output column (class)
  4. User inputs test values
  5. Prediction displayed

Example React Component

import React, { useState } from "react";
import Papa from "papaparse";
import { ResonanceFrequencyClassifier } from "resonance-ml";

export default function MLTrainer() {
  const [csvData, setCsvData] = useState([]);
  const [columns, setColumns] = useState([]);
  const [features, setFeatures] = useState([]);
  const [target, setTarget] = useState("");
  const [prediction, setPrediction] = useState(null);

  const classifier = new ResonanceFrequencyClassifier();

  const handleCSV = (e) => {
    Papa.parse(e.target.files[0], {
      header: true,
      complete: (results) => {
        setCsvData(results.data);
        setColumns(Object.keys(results.data[0]));
      }
    });
  };

  const trainModel = () => {
    classifier.train(csvData, features, target);
  };

  const testPredict = (testInput) => {
    const result = classifier.predict(testInput);
    setPrediction(result);
  };

  return (
    <div>
      <h2>Resonance ML Trainer</h2>

      <input type="file" accept=".csv" onChange={handleCSV} />

      <h3>Select feature columns</h3>
      {columns.map((col) => (
        <label key={col}>
          <input
            type="checkbox"
            value={col}
            onChange={(e) =>
              setFeatures((prev) => [...prev, e.target.value])
            }
          />
          {col}
        </label>
      ))}

      <h3>Select target column</h3>
      <select onChange={(e) => setTarget(e.target.value)}>
        <option>Select...</option>
        {columns.map((col) => (
          <option key={col}>{col}</option>
        ))}
      </select>

      <button onClick={trainModel}>Train Model</button>

      <button
        onClick={() => testPredict({ height: 168, weight: 62 })}
      >
        Predict Test Input
      </button>

      {prediction && <h3>Prediction: {prediction}</h3>}
    </div>
  );
}

API Reference

train(data, featureColumns, targetColumn)

Trains the model.

  • data: Array of objects (CSV rows)
  • featureColumns: Columns used for training
  • targetColumn: Column to predict

predict(inputObject)

Returns the predicted class based on similarity.


License

MIT


Author

Elanesan Kumaravel