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 |
The config
function sets additional models parameters
config(formula = NULL, k = NULL)
config(formula = NULL, k = NULL)
formula |
formula parameter for eg. linear models including lm, rlm, read more: lm |
k |
number of neighbors considered from knn models, read more: knn |
configuration list contains models parameters different than defaults
config(formula = "Status ~ Value")
config(formula = "Status ~ Value")
The model
function generates AI/ML models
model(data, type = "lm", config = NULL, verbose = FALSE)
model(data, type = "lm", config = NULL, verbose = FALSE)
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 |
model list contains model, predicted, and expected values for all generated models
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)
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)
The prodata
function generates an data list for models. It additionally splits data for training and testing set by split ratio.
prodata(data, status_colname, SplitRatio = 0.75)
prodata(data, status_colname, SplitRatio = 0.75)
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 |
data list
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")
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")
The stats
function calculates models statistics. Read more auc
stats(modelA, modelB = NULL)
stats(modelA, modelB = NULL)
modelA |
Model generated by model function |
modelB |
Model generated by model function |
modified model list contains additional statistics
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)
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()
stats_compare_models(modelA, modelB)
stats_compare_models(modelA, modelB)
modelA |
modelA |
modelB |
modelB |
data.frame contains comparison of both models statistics
stats_model()
stats_model(model)
stats_model(model)
model |
model |
list contains model statistics