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 🙏

© 2024 – Pkg Stats / Ryan Hefner

numinajs

v1.0.4

Published

NuminaJS is a comprehensive data science package for JavaScript, providing a wide range of tools for data preprocessing, feature selection, data transformation, machine learning algorithms, and data visualization. It's designed to simplify complex data sc

Downloads

4

Readme

NuminaJS

NuminaJS is a comprehensive data science package for JavaScript, providing a wide range of tools for data preprocessing, feature selection, data transformation, machine learning algorithms, and data visualization. It's designed to simplify complex data science tasks and make them accessible to JavaScript developers.

Table of Contents

  1. Installation
  2. Features
  3. Usage
  4. API Reference
  5. Contributing
  6. License

Installation

npm install numinajs

Features

  • CSV file reading
  • Data preprocessing (handling missing values, outlier detection, normalization)
  • Feature selection (correlation analysis, chi-square test, ANOVA, Lasso, Ridge, Elastic Net)
  • Data transformation
  • Handling imbalanced datasets
  • Supervised learning algorithms (SVM, Linear Regression, Logistic Regression, Decision Trees, Random Forests, KNN, Naive Bayes, Gradient Boosting, AdaBoost, Voting Classifier)
  • Unsupervised learning algorithms (K-Means, Hierarchical Clustering, DBSCAN)
  • Comprehensive model evaluation metrics
  • Cross-validation techniques
  • Data visualization with Chart.js integration
  • Data export to various formats (HTML, JSON, PDF)

Usage

Data Reading

const { readCSV } = require('numinajs');

const data = readCSV('path/to/your/file.csv');
console.log(data);

Data Preprocessing

const { handleMissingValues, detectAndHandleOutliers, normalizeData } = require('numinajs');

// Handle missing values
let processedData = handleMissingValues(data, 'column_name', 'mean');

// Detect and handle outliers
processedData = detectAndHandleOutliers(processedData, 'column_name', 'remove');

// Normalize data
processedData = normalizeData(processedData, 'column_name', 'min-max');

Feature Selection

const { selectFeatures, chiSquareTest, anovaFTest } = require('numinajs');

// Select features based on correlation
const selectedFeatures = selectFeatures(data, 'correlation', 0.5);

// Perform chi-square test
const chiSquareResults = chiSquareTest(data, targetColumn);

// Perform ANOVA F-test
const anovaResults = anovaFTest(data, targetColumn);

Data Transformation

const { transformData } = require('numinajs');

// Apply log transformation
const transformedData = transformData(data, 'column_name', 'log');

Handling Imbalanced Data

const { handleImbalance } = require('numinajs');

// Oversample minority class
const balancedData = handleImbalance(data, 'oversample');

Supervised Learning Algorithms

const { linearRegression, logisticRegression, svm, randomForests } = require('numinajs');

// Linear Regression
const linearModel = linearRegression(data, targetColumn);

// Logistic Regression
const logisticModel = logisticRegression(data, targetColumn);

// Support Vector Machine
const svmModel = svm(data, targetColumn);

// Random Forests
const rfModel = randomForests(data, targetColumn);

Unsupervised Learning Algorithms

const { kMeans, hierarchicalClustering, dbscan } = require('numinajs');

// K-Means Clustering
const kMeansResult = kMeans(data, 3); // 3 clusters

// Hierarchical Clustering
const hierarchicalResult = hierarchicalClustering(data);

// DBSCAN
const dbscanResult = dbscan(data, 0.5, 5); // epsilon = 0.5, minPoints = 5

Model Evaluation Metrics

const { accuracy, precision, recall, f1Score, confusionMatrix, specificity, falsePositiveRate, trueNegativeRate, areaUnderROC, meanSquaredError, rootMeanSquaredError, meanAbsoluteError, rSquared } = require('numinajs');

// Classification metrics
const accuracyScore = accuracy(trueLabels, predictedLabels);
const precisionScore = precision(trueLabels, predictedLabels);
const recallScore = recall(trueLabels, predictedLabels);
const f1 = f1Score(trueLabels, predictedLabels);
const confMatrix = confusionMatrix(trueLabels, predictedLabels);
const specificityScore = specificity(trueLabels, predictedLabels);
const fpr = falsePositiveRate(trueLabels, predictedLabels);
const tnr = trueNegativeRate(trueLabels, predictedLabels);
const auc = areaUnderROC(trueLabels, predictedScores);

// Regression metrics
const mse = meanSquaredError(trueValues, predictedValues);
const rmse = rootMeanSquaredError(trueValues, predictedValues);
const mae = meanAbsoluteError(trueValues, predictedValues);
const r2 = rSquared(trueValues, predictedValues);

Cross-Validation

const { kFoldCrossValidation, stratifiedKFoldCrossValidation } = require('numinajs');

// K-Fold Cross-Validation
const kFoldResults = kFoldCrossValidation(data, labels, model, 5);

// Stratified K-Fold Cross-Validation
const stratifiedResults = stratifiedKFoldCrossValidation(data, labels, model, 5);

Data Visualization

const { plotGraph } = require('numinajs');

// Create a bar chart
const barChartData = {
  labels: ['January', 'February', 'March', 'April', 'May'],
  datasets: [{
    label: 'Sales',
    data: [12, 19, 3, 5, 2],
    backgroundColor: 'rgba(75, 192, 192, 0.6)'
  }]
};

plotGraph(800, 600, 'bar', barChartData, { title: { display: true, text: 'Monthly Sales' } }, 'sales_chart');

Data Export

const { exportToHTML, exportToJSON, exportToPDF } = require('numinajs');

exportToHTML(data, 'output.html');
exportToJSON(data, 'output.json');
exportToPDF(data, 'output.pdf');

API Reference

Data Preprocessing

  • handleMissingValues(data, column, method, specificValue)
  • detectAndHandleOutliers(data, column, method)
  • normalizeData(data, column, method)
  • encodeCategorical(data, column, method)
  • cleanData(data)

Feature Selection

  • selectFeatures(data, method, threshold, column1, column2)
  • chiSquareTest(data, target)
  • anovaFTest(data, target)
  • lassoRegularization(data, target, alpha)
  • ridgeRegularization(data, target, alpha)

Supervised Learning

  • linearRegression(data, target)
  • logisticRegression(data, target, learningRate, iterations)
  • svm(data, target, C, iterations, learningRate)
  • decisionTrees(data, target)
  • randomForests(data, target, numTrees)
  • kNearestNeighbors(data, target, k)
  • naiveBayes(data, target)
  • gradientBoosting(data, target, numTrees, learningRate)
  • adaBoost(data, target, numEstimators)
  • votingClassifier(data, target, models)

Unsupervised Learning

  • kMeans(data, k, maxIterations)
  • hierarchicalClustering(data)
  • dbscan(data, epsilon, minPoints)

Model Evaluation Metrics

  • accuracy(trueLabels, predictedLabels)
  • precision(trueLabels, predictedLabels)
  • recall(trueLabels, predictedLabels)
  • f1Score(trueLabels, predictedLabels)
  • confusionMatrix(trueLabels, predictedLabels)
  • specificity(trueLabels, predictedLabels)
  • falsePositiveRate(trueLabels, predictedLabels)
  • trueNegativeRate(trueLabels, predictedLabels)
  • areaUnderROC(trueLabels, predictedScores)
  • meanSquaredError(trueValues, predictedValues)
  • rootMeanSquaredError(trueValues, predictedValues)
  • meanAbsoluteError(trueValues, predictedValues)
  • rSquared(trueValues, predictedValues)

Cross-Validation

  • kFoldCrossValidation(data, labels, model, k)
  • stratifiedKFoldCrossValidation(data, labels, model, k)

Data Visualization

  • plotGraph(width, height, graphType, data, options, filename)

Data Export

  • exportToHTML(data, filePath)
  • exportToJSON(data, filePath)
  • exportToPDF(data, filePath)

Contributing

We welcome contributions to NuminaJS! Please see our Contributing Guidelines for more information.

License

NuminaJS is released under the MIT License. See the LICENSE file for details.