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

Optimize Feature Engineering Part 2 #9

Merged
merged 1 commit into from
Jul 3, 2024
Merged

Conversation

jylee-bcm
Copy link
Collaborator

  • Applied scalar multiplication to vector, not on matrix
  • Used indexing technique
  • Transformed from float64 to float32

Changed Output

There's subtle change on outputs, but I think they are ignorable.

>>> pd.testing.assert_series_equal(a["diffuse_Phrank_STRING"], b["diffuse_Phrank_STRING"])
Series values are different (0.04513 %)

Reduced the running time

Before:

image

After:

image

* Applied scalar multiplication to vector
* Used indexing technique
* Transformed from float64 to float32
@jylee-bcm jylee-bcm added the enhancement New feature or request label Jul 1, 2024
@jylee-bcm jylee-bcm self-assigned this Jul 1, 2024
@hyunhwan-bcm
Copy link
Owner

Changed Output

There's subtle change on outputs, but I think they are ignorable.

>>> pd.testing.assert_series_equal(a["diffuse_Phrank_STRING"], b["diffuse_Phrank_STRING"])
Series values are different (0.04513 %)

This is an expected behavior (confirmed by Chaozhong), but not sure why. We can ignore this anyway.

Copy link
Owner

@hyunhwan-bcm hyunhwan-bcm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a minor comment. thanks for doing this.

for i in range(0, max_iter):
Fs = np.append(Fs, F, axis=1)
F = alpha * nn @ Fs[:, [i]] + fY
F = nn @ (alpha * Fs[:, [i]]) + (1 - alpha) * y
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

any benefit for using (1 - alpha) * y instead of using fY?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

any benefit for using (1 - alpha) * y instead of using fY?

I thought it adds intuitiveness to the equation, and no drawbacks on speed.

@jylee-bcm
Copy link
Collaborator Author

jylee-bcm commented Jul 2, 2024

This is an expected behavior (confirmed by Chaozhong), but not sure why. We can ignore this anyway.

Because I used float32 instead of float64, for the purpose of speed optimization, but not necessary. It only improves 30s.

Copy link
Owner

@hyunhwan-bcm hyunhwan-bcm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Clear all good

@hyunhwan-bcm hyunhwan-bcm merged commit 246503e into nextflow_conversion Jul 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
2 participants