diff --git a/likelihood/VERSION b/likelihood/VERSION index 434dcac..732aa7d 100644 --- a/likelihood/VERSION +++ b/likelihood/VERSION @@ -1 +1 @@ -1.2.9 \ No newline at end of file +1.2.10 \ No newline at end of file diff --git a/likelihood/graph/graph.py b/likelihood/graph/graph.py index 7a028e7..c9d5151 100644 --- a/likelihood/graph/graph.py +++ b/likelihood/graph/graph.py @@ -1,3 +1,5 @@ +from typing import List + import networkx as nx from IPython.display import HTML, display from pandas.core.frame import DataFrame @@ -16,6 +18,7 @@ def __init__(self, df: DataFrame, n_importances: int, **kwargs): self.df = df self.n_importances = n_importances super().__init__(**kwargs) + self.labels: List[str] = [] def fit(self, **kwargs) -> None: """Fit the model according to the given data and parameters.""" @@ -37,6 +40,7 @@ def _make_network(self) -> None: def _add_nodes(self) -> None: for i in range(len(self.all_features_imp_graph)): node = self.all_features_imp_graph[i][0] + self.labels.append(node) self.G.add_node(n_id=i, label=node) def draw(self, name="graph.html", **kwargs) -> None: @@ -53,13 +57,13 @@ def draw(self, name="graph.html", **kwargs) -> None: def pyvis_to_networkx(self): nx_graph = nx.Graph() - # AƱadimos nodos + # Adding nodes for node_dic in self.G.nodes: id = node_dic["id"] del node_dic["id"] nx_graph.add_nodes_from([(id, node_dic)]) - # AƱadimos aristas + # Adding edges for edge in self.G.edges: source, target = edge["from"], edge["to"] del edge["from"] diff --git a/requirements.txt b/requirements.txt index ffa8427..c073a72 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,14 +1,13 @@ -# Code quality black[jupyter]==24.1.1 -flake8==6.0.0 -mypy==1.4.1 -pydocstyle==6.3.0 mypy-extensions==1.0.0 types-openpyxl==3.1.0.15 +pydocstyle==6.3.0 +flake8==6.0.0 isort==5.12.0 - +mypy==1.4.1 numpy<2.0.0 matplotlib +networkx +pandas corner pyvis -pandas \ No newline at end of file diff --git a/setup.py b/setup.py index 38a75a8..c280597 100644 --- a/setup.py +++ b/setup.py @@ -2,6 +2,10 @@ import setuptools +# Parse the requirements.txt file +with open("requirements.txt", "r") as f: + install_requires = f.read().splitlines() + with open("README.md", "r") as fh: long_description = fh.read() @@ -23,12 +27,7 @@ long_description_content_type="text/markdown", url="https://github.com/jzsmoreno/likelihood/", packages=setuptools.find_packages(), - install_requires=[ - "numpy<2.0.0", - "matplotlib", - "corner", - "pyvis", - ], + install_requires=install_requires, classifiers=[ "Programming Language :: Python :: 3", "License :: OSI Approved :: MIT License",