Skip to content

Commit

Permalink
Merge pull request #27 from UrbsLab/master
Browse files Browse the repository at this point in the history
Update
  • Loading branch information
robertfrankzhang authored Apr 16, 2020
2 parents 8ef49e5 + 16d78f0 commit a4a9ff1
Showing 1 changed file with 27 additions and 1 deletion.
28 changes: 27 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,33 @@ These values can then be exported as a csv after training is complete for analys
In addition, the package includes functionality that allows detailed training evaluation to be done at given iterations during the training process. At each interval, the package saves a snapshot of the rule population, along with evaluation accuracy and instance coverage. These snapshots of the rule population (including the final rule population) can then be exported as a csv after training is complete for analysis using the built in "exportRulePopulationAtIterationToCSV" and "exportFinalRulePopulationToCSV" methods.

## Usage
For more information on the eLCS algorithm and how to use it, please refer to the "eLCS User Guide" Jupyter Notebook inside this repository.
For more information on the eLCS algorithm and how to use it, please refer to the ["eLCS User Guide"](https://github.com/UrbsLab/scikit-eLCS/blob/master/eLCS%20User%20Guide.ipynb) Jupyter Notebook inside this repository.

## Usage TLDR
```python
#Import Necessary Packages/Modules
from skeLCS.eLCS import eLCS
import numpy as np
import pandas as pd
from sklearn.model_selection import cross_val_score

#Load Data Using Pandas
data = pd.read_csv('myDataFile.csv')
dataFeatures = data.drop(classLabel,axis=1).values
dataPhenotypes = data[classLabel].values

#Shuffle Data Before CV
formatted = np.insert(dataFeatures,dataFeatures.shape[1],dataPhenotypes,1)
np.random.shuffle(formatted)
dataFeatures = np.delete(formatted,-1,axis=1)
dataPhenotypes = formatted[:,-1]

#Initialize eLCS Model
model = eLCS(learningIterations = 5000)

#3-fold CV
print(np.mean(cross_val_score(model,dataFeatures,dataPhenotypes,cv=3)))
```

## License
Please see the repository [license](https://github.com/UrbsLab/scikit-eLCS/blob/master/LICENSE) for the licensing and usage information for scikit-eLCS.
Expand Down

0 comments on commit a4a9ff1

Please sign in to comment.