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].

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.1a0.tar.gz (38.4 kB view details)

Uploaded Source

File details

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

File metadata

  • Download URL: mlconcepts-0.0.1a0.tar.gz
  • Upload date:
  • Size: 38.4 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.1a0.tar.gz
Algorithm Hash digest
SHA256 1780933d2d5256c63090daa553f6f4b004120ca80cc7da1fe0911aefeccc6868
MD5 b1d97a429cfdc038e005fbf717157f5e
BLAKE2b-256 1accd7bbed1a42413007cd1fabf9c13b0f115550184b979bbc731f0ea60ba001

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