Code Monkey home page Code Monkey logo

confusiontabler's Introduction

ConfusionTableR - a package to tidy confusion matrix outputs for record level storage

R-CMD-check CRAN status GitHub last commit GitHub Repo stars Downloads

This package was spurred from the motivation of storing confusion matrix outputs in a database, or data frame, in a row by row format, as we have to test many machine learning models and it is useful in storing the structures in a database.

Installing the package from GitHub

Here, I will use the package remotes to install the package:

# install.packages("remotes") # if not already installed
remotes::install_github("https://github.com/StatsGary/ConfusionTableR")
library(ConfusionTableR)

Installing the package from CRAN

To install from CRAN, use the below command:

install.packages("ConfusionTableR")

Loading the package

To load the package:

library(ConfusionTableR)

Using the package

This will download the package and now you can start to use the package with the ML outputs. The supporting Vignette will give the example usage and how to get the most out of the package.

I found this package to be really useful, as I frequently work with confusion matrices on the back of the CARET library - developed by Max Kuhn and his team.

The package aim is to make it easier to convert the outputs of the lists from caret and collapse these down into row-by-row entries, specifically designed for storing the outputs in a database or row by row data frame.

Vignette

The vignette on how to use the package is available here.

Package contents

The package contains three main functions for dealing with binary and multi-class prediction problems, and allows for row level views to be built. The package contents are:

  • binary_visualiseR - this function allows you to create a nice looking visual on the back of a binary classification task.
  • binary_class_cm - this is used for binary classification tasks only and the object passed must be a caret confusion matrix object and class
  • multi_class_cm - this is used for multi-classification tasks only. Refer to the vignette for guidance.

Example of binary_visualiseR output:

Read the linked vignette for the full implementation of how to use the package.

New Additions

The new addition to the ConfusionTableR package is that a dummy encoding function has been added to encode multiple columns across a data frame, as currently most encoding options have only one column at a time potential.

Closing remarks

It has been fun putting this package together and I hope you find it useful. If you find any issues using the package, please raise a git hub ticket and I will address it as soon as possible.

confusiontabler's People

Contributors

statsgary avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

confusiontabler's Issues

ERROR: unable to collate and parse R files for package 'ConfusionTableR'

Tried installing ConfusionTableR on a fresh clean environment Rstudio.


> remotes::install_github("https://github.com/StatsGary/ConfusionTableR")
Downloading GitHub repo StatsGary/ConfusionTableR@HEAD
These packages have more recent versions available.
It is recommended to update all of them.
Which would you like to update?

1: All                               
2: CRAN packages only                
3: None                              
4: colorspace (2.0-1 -> 2.0-2) [CRAN]
5: cpp11      (0.2.7 -> 0.3.1) [CRAN]
6: dplyr      (1.0.6 -> 1.0.7) [CRAN]
7: stringi    (1.5.3 -> 1.6.2) [CRAN]
8: ggplot2    (3.3.3 -> 3.3.5) [CRAN]

Enter one or more numbers, or an empty line to skip updates: 3
Running `R CMD build`...
* checking for file 'C:\Users\joe\AppData\Local\Temp\RtmpKyv7LW\remotes38c048636892\StatsGary-ConfusionTableR-ca25403/DESCRIPTION' ... OK
* preparing 'ConfusionTableR':
* checking DESCRIPTION meta-information ... OK
* checking for LF line-endings in source and make files and shell scripts
* checking for empty or unneeded directories
* building 'ConfusionTableR_1.0.1.tar.gz'
Installing package into 'C:/Users/joe/Documents/PROYECTOS/tm_stacks/renv/library/R-4.0/x86_64-w64-mingw32'
(as 'lib' is unspecified)
* installing *source* package 'ConfusionTableR' ...
** using staged installation
** R
Error in .install_package_code_files(".", instdir) : 
files in 'Collate' field missing from 'C:/Users/joe/AppData/Local/Temp/RtmpSIK6fE/R.INSTALL50387be66fdb/ConfusionTableR/R':
  binaryVisualiseR.R
ERROR: unable to collate and parse R files for package 'ConfusionTableR'
* removing 'C:/Users/joe/Documents/PROYECTOS/tm_stacks/renv/library/R-4.0/x86_64-w64-mingw32/ConfusionTableR'
Warning messages:
1: In untar2(tarfile, files, list, exdir, restore_times) :
  skipping pax global extended headers
2: In untar2(tarfile, files, list, exdir, restore_times) :
  skipping pax global extended headers
3: In i.p(...) :
  installation of package 'C:/Users/joe/AppData/Local/Temp/RtmpKyv7LW/file38c063f450f1/ConfusionTableR_1.0.1.tar.gz' had non-zero exit status

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.