https://github.com/aclai-lab/solemodels.jl

Symbolic modeling in Julia!

https://github.com/aclai-lab/solemodels.jl

Science Score: 46.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
    Links to: scholar.google
  • Committers with academic emails
    1 of 12 committers (8.3%) from academic institutions
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (14.3%) to scientific vocabulary

Keywords

machine-learning symbolic-learning

Keywords from Contributors

logic decision-trees modal-logic time-series-classification
Last synced: 7 months ago · JSON representation

Repository

Symbolic modeling in Julia!

Basic Info
Statistics
  • Stars: 12
  • Watchers: 3
  • Forks: 1
  • Open Issues: 0
  • Releases: 32
Topics
machine-learning symbolic-learning
Created over 4 years ago · Last pushed 7 months ago
Metadata Files
Readme License

README.md

SoleModels.jl – Symbolic Learning Models

Stable CI codecov Binder <!-- Code Style: Blue -->

In a nutshell

SoleModels.jl defines the building blocks of symbolic modeling and learning. It features: - Definitions for symbolic models (decision trees/forests, rules, branches, etc.); - Tools for evaluate them, and extracting rules from them; - Support for mixed, neuro-symbolic computation.

These definitions provide a unified base for implementing symbolic algorithms, such as: - Decision tree/random forest learning; - Classification/regression rule extraction; - Association rule mining.

Models

Basic models are: - Leaf models: wrapping native Julia computation (e.g., constants, functions); - Rules: structures with IF antecedent THEN consequent END semantics; - Branches: structures with IF antecedent THEN pos_consequent ELSE neg_consequent END semantics.

Remember that: - An antecedent is a logical formula that can be checked on a logical interpretation (that is, an instance of a symbolic learning dataset), yielding a truth value (e.g., true/false); - A consequent is another model, for example, a (final) constant model or branch to be applied.

Within this framework, a decision tree is no other than a branch with branch and final consequents. Note that antecedents can consist of logical formulas and, in such case, the symbolic models are can be applied to logical interpretations. For more information, refer to SoleLogics.jl, the underlying logical layer.

Other noteworthy models include: - Decision List (or decision table): see Wikipedia; - Decision Tree: see Wikipedia; - Decision Forest (or tree ensemble): see Wikipedia; - Mixed Symbolic Model: a nested structure, mixture of many symbolic models.

Usage: rule extraction from a decision tree

First, train a decision tree: ```julia

Load packages

begin Pkg.add("MLJ"); using MLJ Pkg.add("MLJDecisionTreeInterface"); using MLJDecisionTreeInterface Pkg.add("DataFrames"); using DataFrames Pkg.add("Random"); using Random end

Load dataset

X, y = begin X, y = @load_iris; X = DataFrame(X) X, y end

Split dataset

Xtrain, ytrain, Xtest, ytest = begin train, test = partition(eachindex(y), 0.8, shuffle=true, rng = Random.MersenneTwister(42)); Xtrain, ytrain = X[train, :], y[train]; Xtest, ytest = X[test, :], y[test]; Xtrain, ytrain, Xtest, ytest end;

Train tree

mach = begin Tree = MLJ.@load DecisionTreeClassifier pkg=DecisionTree model = Tree(maxdepth=-1, rng = Random.MersenneTwister(42)) machine(model, Xtrain, y_train) |> fit! end

Inspect the tree

🌱 = fitted_params(mach).tree ```

Then, port it to Sole and play with it: ```julia Pkg.add("DecisionTree"); import DecisionTree as DT

Convert to 🌞-compliant model

🌲 = solemodel(🌱);

Print model

printmodel(🌲);

Inspect the rules

listrules(🌲)

Inspect rule metrics

metricstable(🌲)

Inspect normalized rule metrics

metricstable(🌲, normalize = true)

Make test instances flow into the model, so that test metrics can, then, be computed.

apply!(🌲, Xtest, ytest)

Pretty table of rules and their metrics

metricstable(🌲; normalize = true, metricskwargs = (; additionalmetrics = (; height = r->SoleLogics.height(antecedent(r)))))

Join some rules for the same class into a single, sufficient and necessary condition for that class

metricstable(joinrules(🌲; min_ncovered = 1, normalize = true)) ```

Want to know more?

The formal foundations of the Sole framework are given in giopaglia's PhD thesis: Modal Symbolic Learning: from theory to practice, G. Pagliarini (2024)

About

The package is developed by the ACLAI Lab @ University of Ferrara.

SoleModels.jl mainly builds upon SoleLogics.jl and SoleData.jl, and it is the core module of Sole.jl, an open-source framework for symbolic machine learning.

Owner

  • Name: Applied Computational Logic and Artificial Intelligence Laboratory
  • Login: aclai-lab
  • Kind: organization
  • Email: aclai@unife.it
  • Location: Italy

Applied Computational Logic and Artificial Intelligence (ACLAI) Laboratory of the Department of Mathematics and Computer Science, University of Ferrara

GitHub Events

Total
  • Create event: 29
  • Commit comment event: 3
  • Issues event: 5
  • Release event: 3
  • Watch event: 1
  • Delete event: 32
  • Issue comment event: 36
  • Push event: 230
  • Pull request review event: 13
  • Pull request review comment event: 15
  • Pull request event: 59
  • Fork event: 2
Last Year
  • Create event: 29
  • Commit comment event: 3
  • Issues event: 5
  • Release event: 3
  • Watch event: 1
  • Delete event: 32
  • Issue comment event: 36
  • Push event: 230
  • Pull request review event: 13
  • Pull request review comment event: 15
  • Pull request event: 59
  • Fork event: 2

Committers

Last synced: 12 months ago

All Time
  • Total Commits: 614
  • Total Committers: 12
  • Avg Commits per committer: 51.167
  • Development Distribution Score (DDS): 0.277
Past Year
  • Commits: 169
  • Committers: 8
  • Avg Commits per committer: 21.125
  • Development Distribution Score (DDS): 0.296
Top Committers
Name Email Commits
giopaglia 2****a 444
Michele21 g****2@g****m 66
mauro-milella m****o@l****t 50
edo-007 e****7@g****m 22
PasoStudio73 p****3@g****m 9
CompatHelper Julia c****y@j****g 7
Alberto Paparella p****t@u****t 5
Federico Manzella f****a@g****m 4
mauro.milella m****a@e****t 2
eduardstan s****d@g****m 2
Perro2110 p****1@g****m 2
paraandrea a****i@g****m 1
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 7 months ago

All Time
  • Total issues: 6
  • Total pull requests: 76
  • Average time to close issues: 28 days
  • Average time to close pull requests: 3 months
  • Total issue authors: 4
  • Total pull request authors: 8
  • Average comments per issue: 20.17
  • Average comments per pull request: 0.59
  • Merged pull requests: 22
  • Bot issues: 0
  • Bot pull requests: 56
Past Year
  • Issues: 4
  • Pull requests: 43
  • Average time to close issues: about 2 months
  • Average time to close pull requests: 30 days
  • Issue authors: 2
  • Pull request authors: 7
  • Average comments per issue: 0.0
  • Average comments per pull request: 1.05
  • Merged pull requests: 17
  • Bot issues: 0
  • Bot pull requests: 25
Top Authors
Issue Authors
  • PasoStudio73 (3)
  • giopaglia (1)
  • alberto-paparella (1)
  • JuliaTagBot (1)
Pull Request Authors
  • github-actions[bot] (52)
  • Perro2110 (5)
  • mauro-milella (5)
  • PasoStudio73 (4)
  • dependabot[bot] (4)
  • alberto-paparella (3)
  • giopaglia (2)
  • paraandrea (2)
Top Labels
Issue Labels
enhancement (2)
Pull Request Labels
dependencies (4) github_actions (4) enhancement (4)

Packages

  • Total packages: 1
  • Total downloads:
    • julia 4 total
  • Total dependent packages: 2
  • Total dependent repositories: 0
  • Total versions: 32
juliahub.com: SoleModels

Symbolic modeling in Julia!

  • Versions: 32
  • Dependent Packages: 2
  • Dependent Repositories: 0
  • Downloads: 4 Total
Rankings
Dependent repos count: 9.8%
Average: 37.3%
Dependent packages count: 38.4%
Stargazers count: 46.4%
Forks count: 54.6%
Last synced: 7 months ago

Dependencies

.github/workflows/TagBot.yml actions
  • JuliaRegistries/TagBot v1 composite
.github/workflows/CompatHelper.yml actions
  • julia-actions/setup-julia v1 composite
.github/workflows/Documentation.yml actions
  • actions/checkout v2 composite
  • julia-actions/setup-julia latest composite
.github/workflows/ci.yml actions
  • actions/checkout v2 composite
  • codecov/codecov-action v3 composite
  • julia-actions/julia-buildpkg v1 composite
  • julia-actions/julia-processcoverage v1 composite
  • julia-actions/julia-runtest v1 composite
  • julia-actions/setup-julia v1 composite