Data Science and Machine Learning (data-science-ml-ai999x)

Data Science and Machine Learning covers evaluation metrics, loss functions and gradients, classical machine-learning algorithms, dimensionality reduction, cross-validation, information theory and neural-network arithmetic: 107 calculations in 14 topics, each with its formula, its steps and its units, and a plain reason instead of a number when an input is missing or out of range. One compiled engine, four ways to use it: the desktop app, the command line, the browser and Python. Everything runs on your own computer, offline.

The Data Science and Machine Learning desktop app: Binary classification metrics from confusion counts, with its worked example and live scene

Four ways to use it

Desktop app (Windows, Linux) Windows · Linux
Command line data-science-ml (Windows, Linux) Windows · Linux
Browser (any device) Try it on the model page
Python 3.10+ pip install data-science-ml-ai999x: on Windows and Linux (x86-64) pip installs the same compiled engine; on other systems (macOS, ARM) it installs a pure-Python build that gives the same answers

See it

From the Data Science and Machine Learning desktop app: every scene and chart is drawn from the computed answer.

Data Science and Machine Learning desktop app: a slider moves an input and the answer, the scene and the charts follow

Watch the full clip (MP4)

Binary classification metrics from confusion counts: the live scene in the Data Science and Machine Learning desktop app
Binary classification metrics from confusion counts
k-means clustering from given initial centroids: the live scene in the Data Science and Machine Learning desktop app
k-means clustering from given initial centroids
Scaled dot-product attention: the live scene in the Data Science and Machine Learning desktop app
Scaled dot-product attention
Adjusted mutual information of two clusterings: the live scene in the Data Science and Machine Learning desktop app
Adjusted mutual information of two clusterings
Principal component analysis (explained variance and first component): the live scene in the Data Science and Machine Learning desktop app
Principal component analysis (explained variance and first component)
One gradient-descent step for linear regression: the live scene in the Data Science and Machine Learning desktop app
One gradient-descent step for linear regression
Lasso regression coefficients (stated alpha): the live scene in the Data Science and Machine Learning desktop app
Lasso regression coefficients (stated alpha)
Binary cross-entropy with logits and its gradient: the live scene in the Data Science and Machine Learning desktop app
Binary cross-entropy with logits and its gradient

Charts:

Binary classification metrics from confusion counts: a chart in the Data Science and Machine Learning desktop app
Binary classification metrics from confusion counts
k-means clustering from given initial centroids: a chart in the Data Science and Machine Learning desktop app
k-means clustering from given initial centroids
Scaled dot-product attention: a chart in the Data Science and Machine Learning desktop app
Scaled dot-product attention
Adjusted mutual information of two clusterings: a chart in the Data Science and Machine Learning desktop app
Adjusted mutual information of two clusterings

Ask in words: 15 examples

Each question below was asked on this release; the comment under it is the line it printed.

import data_science_ml_ai999x as data_science_ml

a = data_science_ml.ask(
    "Adjusted R squared: y_true = [10, 20, 30, 40, 50], y_pred = [12, "
    "18, 33, 37, 52], p = 1"
)
print(a.outcome, a.values)
# SOLVED {'r2': 0.97, 'adjusted_r2': 0.96}

a = data_science_ml.ask(
    "Mean absolute percentage error: y_true = [100, 200, 300], y_pred "
    "= [110, 190, 330]"
)
print(a.outcome, a.values)
# SOLVED {'mape': 0.0833333333333, 'mape_percent': 8.33333333333}

a = data_science_ml.ask(
    "Balanced accuracy: y_true = [0, 0, 0, 0, 0, 0, 1, 1], y_pred = "
    "[0, 0, 0, 0, 0, 0, 0, 1]"
)
print(a.outcome, a.values)
# SOLVED {'balanced_accuracy': 0.75, 'adjusted': 0.5}

a = data_science_ml.ask(
    "Davies-Bouldin index: X = [[1, 1], [1.5, 2], [3, 4], [5, 7], "
    "[3.5, 5], [4.5, 5]], labels = [0, 0, 1, 1, 1, 1]"
)
print(a.outcome, a.values)
# SOLVED {'davies_bouldin': 0.37473357715}

a = data_science_ml.ask(
    "Cosine learning rate schedule: lr_max = 0.1, eta_min = 0, T_max = "
    "100, epoch = 50"
)
print(a.outcome, a.values)
# SOLVED {'lr': 0.05}

a = data_science_ml.ask(
    "Mean squared log error: y_true = [3, 5, 2.5, 7], y_pred = [2.5, "
    "5, 4, 8]"
)
print(a.outcome, a.values)
# SOLVED {'msle': 0.0397301229846, 'rmsle': 0.199324165581}

a = data_science_ml.ask(
    "Leave-one-out cross-validation of linear regression: X = [[1], "
    "[2], [3], [4], [5], [6]], y = [1.1, 1.9, 3.2, 3.9, 5.1, 5.8]"
)
print(a.outcome, a.values)
# SOLVED {'press': 0.210910888993, 'loocv_mse': 0.0351518148321}

a = data_science_ml.ask(
    "Convolution output size: n = 32, kernel = 3, stride = 1, padding "
    "= 1, dilation = 1"
)
print(a.outcome, a.values)
# SOLVED {'output_size': 32, 'effective_kernel': 3}

a = data_science_ml.ask(
    "Warmup cosine schedule: lr_max = 0.001, start_factor = 0.1, "
    "warmup = 10, total = 100, eta_min = 0, step = 5"
)
print(a.outcome, a.values)
# SOLVED {'lr': 0.00055}

a = data_science_ml.ask(
    "Tweedie deviance: y_true = [2, 0, 1, 4], y_pred = [0.5, 0.5, 2, "
    "2], power = 1"
)
print(a.outcome, a.values)
# SOLVED {'deviance': 1.42601513196}

a = data_science_ml.ask(
    "Normalized mutual information: labels_true = [0, 0, 1, 1, 2, 2], "
    "labels_pred = [0, 0, 1, 1, 1, 1], method = arithmetic"
)
print(a.outcome, a.values)
# SOLVED {'nmi': 0.733680436651, 'mutual_information': 0.636514168295}

a = data_science_ml.ask(
    "Hinge loss: y_true = [1, -1, 1, -1], scores = [2, -0.5, 0.3, 0.8]"
)
print(a.outcome, a.values)
# SOLVED {'hinge': 0.75, 'squared_hinge': 0.995, 'n_violations': 3}

a = data_science_ml.ask(
    "Train test split sizes: n = 100, test_size = 0.2"
)
print(a.outcome, a.values)
# SOLVED {'n_test': 20, 'n_train': 80}

a = data_science_ml.ask(
    "Dense network forward pass: x = [1, 2], W1 = [[0.5, -0.25], [0.1, "
    "0.3]], b1 = [0.1, -0.2], activation = relu, W2 = [[1, -1]], b2 = "
    "[0.05], output = identity"
)
print(a.outcome, a.values)
# SOLVED {'hidden': [0.1, 0.5], 'output': [-0.35], 'max_output': -0.35}

a = data_science_ml.ask(
    "SGD momentum step: w = [1, -2], grad = [0.5, -1], buf = [0.1, "
    "0.2], lr = 0.1, momentum = 0.9, nesterov = no, weight_decay = 0"
)
print(a.outcome, a.values)
# SOLVED {'buf_new': [0.59, -0.82], 'w_new': [0.941, -1.918]}

Command line: 15 examples

Each command below was run with data-science-ml of this release; the lines under it are the answer it printed (the full answer goes on with the method, every input in SI units and the conditions it assumes).

$ data-science-ml solve ml_hierarchical_clustering "X=[[0, 0], [0, 1], [4, 0], [4, 1.5], [10, 10]]" method=single
heights = [1.0,1.5,4.0,10.4043260233]
final_height = 10.40432602

$ data-science-ml solve ml_average_precision "y_true=[0, 1, 1, 0, 1]" "scores=[0.1, 0.9, 0.8, 0.3, 0.2]"
average_precision = 0.9166666667
pr_auc_trapezoid = 0.9027777778

$ data-science-ml solve ml_adjusted_mutual_information "labels_true=[0, 0, 1, 1, 2, 2]" "labels_pred=[0, 0, 1, 1, 1, 1]" method=arithmetic
ami = 0.6153846154
expected_mi = 0.266835672
mutual_information = 0.6365141683

$ data-science-ml solve ml_pca "X=[[2.5, 2.4], [0.5, 0.7], [2.2, 2.9], [1.9, 2.2], [3.1, 3], [2.3, 2.7], [2, 1.6], [1, 1.1], [1.5, 1.6], [1.1, 0.9]]"
explained_variance = [1.28402771217,0.0490833989383]
explained_variance_ratio = [0.963181314349,0.0368186856514]
component_1 = [0.677873398528,0.735178655544]
scores_1 = [0.827970186201,-1.77758032528,0.992197494415,0.274210415975,1.67580141864,0.912949103159,-0.0991094374984,-1.1445721638,-0.438046136762,-1.22382055505]

$ data-science-ml solve ml_logistic_loss_gradient "X=[[1, 2], [2, 1], [3, 3]]" "y=[0, 1, 1]" "w=[0.5, -0.25]" b=0.1 lam=0
loss = 0.485375599
grad_w = [-0.32406170005,-0.0492576850487]
grad_b = -0.02462884252

$ data-science-ml solve ml_gini_split "y=[0, 0, 0, 1, 1, 1, 1, 0]" "g=[0, 0, 0, 0, 1, 1, 1, 1]"
gini_parent = 0.5
gini_children = 0.375
gini_decrease = 0.125

$ data-science-ml solve ml_lasso_regression "X=[[1, 0.5], [2, 1.5], [3, 1], [4, 3], [5, 2], [6, 3.5]]" "y=[1.1, 2.3, 2.9, 4.2, 5.1, 5.8]" alpha=0.1
w = [0.914285714286,0.0]
b = 0.3666666667
n_nonzero = 1

$ data-science-ml solve ml_bce_with_logits "y=[1, 0, 1]" "z=[2, -1, -0.5]"
loss = 0.4714222276
gradient = [-0.0397343073407,0.0896471404567,-0.207486443734]

$ data-science-ml solve ml_bias_variance_decomposition "P=[[1, 2], [3, 2.5], [2, 3.5]]" "f=[1.5, 2.5]"
bias_squared = 0.1388888889
variance = 0.5277777778
expected_mse = 0.6666666667

$ data-science-ml solve ml_conv2d_forward "image=[[1, 2, 3, 0], [0, 1, 2, 3], [3, 0, 1, 2], [2, 3, 0, 1]]" "kernel=[[2, 0, 1], [0, 1, 2], [1, 0, 2]]" stride=1 padding=0
output = [[15.0,16.0],[6.0,15.0]]
output_sum = 52

$ data-science-ml solve ml_adam_step "w=[1, -2]" "grad=[0.5, -1]" "m=[0, 0]" "v=[0, 0]" t=1 lr=0.001 beta1=0.9 beta2=0.999 eps=1e-08
m_new = [0.05,-0.1]
v_new = [0.00025,0.001]
w_new = [0.99900000002,-1.99900000001]

$ data-science-ml solve ml_one_hot_encoding "categories=red, green, red, blue, green, red"
categories = ["blue","green","red"]
counts = [1,2,3]
codes = [2,1,2,0,1,2]
one_hot = [[0,0,1],[0,1,0],[0,0,1],[1,0,0],[0,1,0],[0,0,1]]

$ data-science-ml solve ml_mean_average_precision "R=[[1, 0, 1, 0, 0], [0, 1, 0, 0, 1]]"
average_precision = [0.833333333333,0.45]
map = 0.6416666667

$ data-science-ml solve ml_adjusted_r2 "y_true=[10, 20, 30, 40, 50]" "y_pred=[12, 18, 33, 37, 52]" p=1
r2 = 0.97
adjusted_r2 = 0.96

$ data-science-ml solve ml_bernoulli_naive_bayes "X=[[1, 0, 1], [1, 1, 0], [0, 1, 1], [0, 0, 1], [1, 1, 1]]" "y=[0, 0, 1, 1, 0]" "x=[1, 0, 0]" alpha=1
prediction = 0
classes = [0,1]
posteriors = [0.860022396417,0.139977603583]

Guides

  • Desktop app guide: the window, every calculation, scenes and charts: PDF · HTML · Markdown
  • Python guide: every calculation with a Python example: PDF · HTML · Markdown
  • Command-line guide: every calculation with the command and what it printed: PDF · HTML · Markdown

Every calculation, with its formula, a worked example and its figures: Data Science and Machine Learning on ai999x.com. Install guides for the app and the command line: https://www.ai999x.com/desktop-cli/.

Version 1.6.7 · License: Apache-2.0 · Author: Ibnul Jaif Farabi · Organization: AI999X · Contact: support@ai999x.com · Support the project

The Future Is Self-Improving.

Downloads last month
274
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Collections including AI999X/data-science-ml-ai999x

Evaluation results

  • identical on every platform on Golden answers (711 documented questions, Windows + Linux Python 3.10-3.14)
    self-reported
    1.000