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.
npm install numinajs
- 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)
const { readCSV } = require('numinajs');
const data = readCSV('path/to/your/file.csv');
console.log(data);
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');
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);
const { transformData } = require('numinajs');
// Apply log transformation
const transformedData = transformData(data, 'column_name', 'log');
const { handleImbalance } = require('numinajs');
// Oversample minority class
const balancedData = handleImbalance(data, 'oversample');
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);
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
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);
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);
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');
const { exportToHTML, exportToJSON, exportToPDF } = require('numinajs');
exportToHTML(data, 'output.html');
exportToJSON(data, 'output.json');
exportToPDF(data, 'output.pdf');
handleMissingValues(data, column, method, specificValue)
detectAndHandleOutliers(data, column, method)
normalizeData(data, column, method)
encodeCategorical(data, column, method)
cleanData(data)
selectFeatures(data, method, threshold, column1, column2)
chiSquareTest(data, target)
anovaFTest(data, target)
lassoRegularization(data, target, alpha)
ridgeRegularization(data, target, alpha)
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)
kMeans(data, k, maxIterations)
hierarchicalClustering(data)
dbscan(data, epsilon, minPoints)
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)
kFoldCrossValidation(data, labels, model, k)
stratifiedKFoldCrossValidation(data, labels, model, k)
plotGraph(width, height, graphType, data, options, filename)
exportToHTML(data, filePath)
exportToJSON(data, filePath)
exportToPDF(data, filePath)
We welcome contributions to NuminaJS! Please see our Contributing Guidelines for more information.
NuminaJS is released under the MIT License. See the LICENSE file for details.