Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sparse dot product #21

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions ikarus/classifier.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ def calculate_connectivities(
path = Path.cwd() / out_dir / name
path.mkdir(parents=True, exist_ok=True)
save_npz(path / "connectivities_sparse.npz", sparse)
return sparse.todense()
return sparse


def propagate_labels(
Expand Down Expand Up @@ -113,8 +113,8 @@ def propagate_labels(
] = True
final_pred_proba.loc[certainty_info[f"certain{i}"] == False] = 0.000001

final_step_mtx = np.dot(connectivities, final_pred_proba.values)
final_step_mtx = np.divide(final_step_mtx, final_step_mtx.sum(axis=1))
final_step_mtx = connectivities.dot(final_pred_proba.values)
final_step_mtx = np.divide(final_step_mtx, final_step_mtx.sum(axis=0))
epaaso marked this conversation as resolved.
Show resolved Hide resolved
final_pred_proba.loc[:, :] = final_step_mtx

current = final_pred_proba.idxmax(axis=1)
Expand Down Expand Up @@ -393,7 +393,7 @@ def predict(
self.out_dir,
)
else:
connectivities = load_npz(connectivities_path).todense()
connectivities = load_npz(connectivities_path)
if connectivities.shape[0] != adata.shape[0]:
raise IndexError(
f"Shape of connectivities matrix ({connectivities.shape}) does "
Expand Down Expand Up @@ -550,7 +550,7 @@ def cnv_correct(
self.out_dir,
)
else:
connectivities = load_npz(connectivities_path).todense()
connectivities = load_npz(connectivities_path)
if connectivities.shape[0] != adata.shape[0]:
raise IndexError(
f"Shape of connectivities matrix ({connectivities.shape}) does "
Expand Down