Skip to content

Commit

Permalink
Update graph.py
Browse files Browse the repository at this point in the history
[FIX] GitHub Actions workflow
  • Loading branch information
jzsmoreno committed Apr 11, 2024
1 parent bbc214a commit 3003199
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 15 deletions.
2 changes: 1 addition & 1 deletion likelihood/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.2.9
1.2.10
8 changes: 6 additions & 2 deletions likelihood/graph/graph.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from typing import List

import networkx as nx
from IPython.display import HTML, display
from pandas.core.frame import DataFrame
Expand All @@ -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."""
Expand All @@ -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:
Expand All @@ -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"]
Expand Down
11 changes: 5 additions & 6 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -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
11 changes: 5 additions & 6 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand All @@ -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",
Expand Down

0 comments on commit 3003199

Please sign in to comment.