Skip to main content

A small library implementing several interpretable machine learning algorithms based on FCA.

Project description

mlconcepts

This library is a wrapper around libmlconcepts, namely a c++ library which implements a series of (interpretable) machine learning algorithms based on FCA, e.g. [3].

Installing mlconcepts from a source distribution only requires a c++23 compiler, all the other dependencies are automatically fetched. If cmake is not able to find the compiler during the installation process, please set the environment variable CXX as follows

CXX = /path/to/c++/compiler

Basic example

Assuming that a dataset containing a column outlier is stored in the file dataset.csv, a basic model could be trained as follows.

import mlconcepts

model = mlconcepts.SODModel() #creates the model
model.fit("dataset.csv", labels = "outlier") #trains the model on the dataset
model.save("model.bin") #compresses and serializes the model to file

A slightly more involved example

import mlconcepts
import mlconcepts.data
import sklearn.metrics
import sklearn.model_selection

#Loads the dataset.
data = mlconcepts.data.load("dataset.csv", labels = "outlier")

#data.split takes as an input any splits generator, such as the ones of sklearn
skf = sklearn.model_selection.StratifiedKFold(n_splits = 4, shuffle = True)
for train, test in data.split(skf):
	model = mlconcepts.SODModel(
		    n = 32, #number of bins for quantization
            epochs = 1000, #number of training iterations
            show_training = False #whether to show training info
	)
	model.fit(train)
	predictions = model.predict(test)
	print("AUC: ", sklearn.metrics.roc_auc_score(test.y, predictions))

References

[1] Flexible categorization for auditing using formal concept analysis and Dempster-Shafer theory

[2] A Meta-Learning Algorithm for Interrogative Agendas

[3] Outlier detection using flexible categorisation and interrogative agendas

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mlconcepts-0.0.1a1.tar.gz (38.8 kB view details)

Uploaded Source

File details

Details for the file mlconcepts-0.0.1a1.tar.gz.

File metadata

  • Download URL: mlconcepts-0.0.1a1.tar.gz
  • Upload date:
  • Size: 38.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.9.19

File hashes

Hashes for mlconcepts-0.0.1a1.tar.gz
Algorithm Hash digest
SHA256 7f4d311baac97b4a39888a5876a6e10f3e28754fb3506752d96c1453eecb0ada
MD5 5bcf1ae2f70862fef7c1d78c2a78462c
BLAKE2b-256 5c653055b0c12433d8f3a247aec4a4557c4b58633dbac7456f683da37350e064

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page