cmaclell / concept_formation

Python implementations of TRESTLE, COBWEB/3, and COBWEB
MIT License
61 stars 18 forks source link

Visualisation problem - Can't find the d3 library #91

Open Adahn opened 4 years ago

Adahn commented 4 years ago

I use Python version 3.7.7.

I tried to visualise the tree of the mushroom_examples you provided :

`from future import print_function from future import unicode_literals from future import absolute_import from future import division from random import shuffle from random import seed

import matplotlib.pyplot as plt from sklearn.decomposition import PCA from sklearn.feature_extraction import DictVectorizer from sklearn.metrics import adjusted_rand_score

from concept_formation.cobweb import CobwebTree from concept_formation.cluster import cluster from concept_formation.datasets import load_mushroom from concept_formation.visualize import visualize_clusters

seed(0) mushrooms = load_mushroom() shuffle(mushrooms) mushrooms = mushrooms[:150]

tree = CobwebTree() mushrooms_no_class = [{a: mushroom[a] for a in mushroom if a != 'classification'} for mushroom in mushrooms] clusters = next(cluster(tree, mushrooms_no_class)) visualize_clusters(tree, clusters)`

The page is opening in the browser but the tree is not shown. As you can see on the screenshot, I get the following warning: Can't find the d3 library. Currently the viz assumes it can get it from a CDN on the internet. Screenshot from 2020-05-12 11-51-50