Skip to content

a multivariate clustering function and a multivariate classification class for artificial intelligence, working with JSON/dict format.

Notifications You must be signed in to change notification settings

LorenzoDoremi/multivariable_clustering

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 

Repository files navigation

Multivariable Clustering

This functions allows you to train a clustering AI to cluster dictionaries based on multiple variables you can choose.

the main parameters are:

  • data: a list of dictionaries.
  • save_key: a string used to save the names inside the sets. for readability
  • keys: a list of strings containing the dictionary entries. see example
  • iteractions: how many time you want to repeat the process (the more, the more accurate)
  • num_sets: how many sets you want.

Use example

animali = [
{"name": "cat", "weight": 48, "age": 3, "length": 155, "class": "feline"},
{"name": "dog", "weight": 60, "age": 8, "length": 150, "class": "canid"},
{"name": "tiger", "weight": 170, "age": 4, "length": 270, "class": "feline"}]


keys = ["weight", "age", "length"]
save_key = "name"



sets = multivariable_clustering(animali, save_key, keys, 100, 5)

insert_data(sets, {"name": "New Fish", "weight": 0, "age": 99, "length": 99}, keys, save_key);

#get data
print(sets[0].get_JSON()) 



Average Classifier

This is a classifier class that lets you train an AI to a dictionary dataset, and then will return the most probable class of a new dictionary element, using a simple average algorithm

the main parameters are:

  • data: a list of dictionaries.
  • keys: a list of strings containing the dictionary entries. see example
  • c_class: the dictionary entry used as the class name
# example keys used
keys = ["length", "age", "weight"]
c_class = "class"


classifier = avg_classifier(keys, c_class)
classifier.train_avg_classifier(animali)
presumed_class = classifier.avg_classify({"name": "New Cat", "weight": 10, "age": 6, "length": 150})

About

a multivariate clustering function and a multivariate classification class for artificial intelligence, working with JSON/dict format.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages