Skip to content

Commit d710246

Browse files
committed
Update README.md
- Update description and Inference example - Add installation guide - Add Generation example
1 parent 291b4f8 commit d710246

File tree

1 file changed

+49
-5
lines changed

1 file changed

+49
-5
lines changed

README.md

Lines changed: 49 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,34 @@
1-
# py-fcm
2-
Fuzzy cognitive maps python library
1+
# PyFCM
2+
Fuzzy cognitive maps python library. Also, supports the topology generation from data to solve classification problems.
3+
The details associated to the generation process are described in [this paper](https://link.springer.com/chapter/10.1007/978-3-030-89691-1_25).
4+
### Installation
35

4-
###Example usage
6+
#### From source:
57

8+
1. Clone repository:
9+
```
10+
$ git clone https://github.com/J41R0/PyFCM.git
11+
$ cd PyFCM
12+
```
13+
2. Install setup tools and package:
14+
```
15+
$ pip install setuptools
16+
$ python setup.py install
17+
```
18+
#### From PyPi:
19+
1. Install package using pip:
20+
```
21+
$ pip install py-fcm
22+
```
23+
24+
### Example usage
25+
26+
#### Inference:
627
```
728
from py_fcm import from_json
829

930
fcm_json = """{
10-
"max_iter": 500,
31+
"max_iter": 500,
1132
"decision_function": "LAST",
1233
"activation_function": "sigmoid",
1334
"memory_influence": False,
@@ -54,6 +75,29 @@ fcm_json = """{
5475
"""
5576
my_fcm = from_json(fcm_json)
5677
my_fcm.run_inference()
57-
result = my_fcm.get_result_by_type(node_type='any')
78+
result = my_fcm.get_final_state(concept_type='any')
5879
print(result)
80+
```
81+
82+
#### Generation:
83+
```
84+
import pandas
85+
from py_fcm import FcmEstimator
86+
87+
data_dict = {
88+
'F1': ['x', 'x', 'y', 'y'],
89+
'F2': [9.8, 7.3, 1.1, 3.6],
90+
'class': ['a', 'a', 'r', 'r']
91+
}
92+
93+
train = pandas.DataFrame(data_dict)
94+
x_train = train.loc[:, train.columns != 'class']
95+
y_train = train.loc[:, 'class']
96+
97+
estimator = FcmEstimator()
98+
estimator.fit(x_train, y_train)
99+
print(estimator.predict(x_train))
100+
print("Accuracy: ",estimator.score(x_train, y_train))
101+
print(estimator.get_fcm().to_json())
102+
59103
```

0 commit comments

Comments
 (0)