-
Notifications
You must be signed in to change notification settings - Fork 108
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
Ant project-Jacobi-EVD and Jacobi-PCA #950
base: main
Are you sure you want to change the base?
Conversation
…nt based on Jacobi-evd
I have read the CLA Document and I hereby sign the CLA fdddy seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account. |
Stale pull request message. Please comment to remove stale tag. Otherwise this pr will be closed soon. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
不要更改这个文件哈~
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
用buildfier格式化一下,参考这里,后同
@@ -0,0 +1,16 @@ | |||
|
|||
|
|||
load("@rules_python//python:defs.bzl", "py_library") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
用SPU里定义的spu_py_xxx
,后同
# ONLY test small matrix for usage purpose | ||
n = 10 | ||
mat = jnp.array(np.random.rand(n, n)) | ||
mat = (mat + mat.T) / 2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个方法只适用于对称矩阵么?
|
||
return index_pairs | ||
|
||
def serial_jacobi_evd( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
麻烦增加一些必要的注释信息,起码需要包括:
- 明文下原始算法名称(最好包括ref)
- (optional)若有与明文算法不同处,可以简单概括并说明一下
- 涉及的参数介绍 以及 返回值介绍
import jax.numpy as jnp | ||
import numpy as np | ||
|
||
import spu.spu_pb2 as spu_pb2 # type: ignore |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
import spu.spu_pb2 as spu_pb2
is not valid anymore, use import spu.libspu as libspu
instead, you can refer to the sml/cluster/tests/kmeans_test.py
|
||
J_combined = J.copy() | ||
for i in range(len(pair)): | ||
if(mask.at[i]): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里的mask是 public value?
for i in range(len(pair)): | ||
if(mask.at[i]): | ||
k, l = ks[i], ls[i] | ||
J_combined = J_combined.at[k, k].set(c[i]).at[l, l].set(c[i]).at[k, l].set(s[i]).at[l, k].set(-s[i]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rows: [k,l,k,l], cols: [k,l,l,k],vals: [c,c,s,-s]
J_combined.at[rows, cols].set(vals)
可以试一试把多个.at .set 合并成一个
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
所有python文件也需要格式化一下,参考上面的链接
sign 一下 CLA哈~ |
Pull Request
What problem does this PR solve?
[Feature] Add a new eigendecomposition method called Jacobi and the PCA implement based on Jacobi-evd