Package 'ai'

Title: Build, Predict and Analyse Artificial Intelligence Models
Description: An interface for data processing, building models, predicting values and analysing outcomes. Fitting Linear Models, Robust Fitting of Linear Models, k-Nearest Neighbor Classification, 1-Nearest Neighbor Classification, and Conditional Inference Trees are available.
Authors: Rafal Urniaz [aut, cre]
Maintainer: Rafal Urniaz <[email protected]>
License: GPL-3
Version: 1.0.4.44
Built: 2024-10-15 16:19:38 UTC
Source: https://github.com/urniaz/ai

Help Index


Models parameters

Description

The config function sets additional models parameters

Usage

config(formula = NULL, k = NULL)

Arguments

formula

formula parameter for eg. linear models including lm, rlm, read more: lm

k

number of neighbors considered from knn models, read more: knn

Value

configuration list contains models parameters different than defaults

Examples

config(formula = "Status ~ Value")

AI/ML models

Description

The model function generates AI/ML models

Usage

model(data, type = "lm", config = NULL, verbose = FALSE)

Arguments

data

data object with data to be modeled, read more prodata

type

model type, lm (Fitting Linear Models) by default; available are lm, rlm, ctree, knn, knn1

config

additional parameters for model, read more config

verbose

if true the messages are displayed in console, false by default

Value

model list contains model, predicted, and expected values for all generated models

Examples

model_data <- data.frame(a = c(1,2,3,4,5,6),
                         b = c(1,2,3,4,5,6),
                         s = c(1,2,3,4,5,6))

config <- config(formula = "a ~ b + s")

model_data <- prodata(model_data, status_colname = "s")

model(model_data, config)

Data processing

Description

The prodata function generates an data list for models. It additionally splits data for training and testing set by split ratio.

Usage

prodata(data, status_colname, SplitRatio = 0.75)

Arguments

data

data.frame with data to be modeled

status_colname

name of the column in data where the true results (true positive, expected) values are listed

SplitRatio

Splitting ratio; 0.75 means 75% data for training and 25% for testing, more: sample.split

Value

data list

Examples

model_data <- data.frame(a = c(1,2,3,4,5,6),
                         b = c(1,2,3,4,5,6),
                         s = c(1,2,3,4,5,6))

prodata(data = model_data, status_colname = "s")

Models statistics

Description

The stats function calculates models statistics. Read more auc

Usage

stats(modelA, modelB = NULL)

Arguments

modelA

Model generated by model function

modelB

Model generated by model function

Value

modified model list contains additional statistics

Examples

model_data <- data.frame(a = c(1,2,3,4,5,6),
                         b = c(1,2,3,4,5,6),
                         s = c(1,2,3,4,5,6))

model_data <- prodata(model_data, status_colname = "s")

config <- config(formula = "a ~ b + s")

model <- model(model_data, config)

stats(model)

stats_compare_models()

Description

stats_compare_models()

Usage

stats_compare_models(modelA, modelB)

Arguments

modelA

modelA

modelB

modelB

Value

data.frame contains comparison of both models statistics


stats_model()

Description

stats_model()

Usage

stats_model(model)

Arguments

model

model

Value

list contains model statistics