-
-
Notifications
You must be signed in to change notification settings - Fork 68
Add sparse-data unit test for xvector-based linear regression #643
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
Changes from all commits
5a1727b
bbc5794
bff0c30
7868466
971e761
1c7a046
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1160,7 +1160,6 @@ namespace minsky | |
| dimension=i-xv.begin(); | ||
| } | ||
|
|
||
| sumy.setArgument(y,args); | ||
| TensorPtr spreadX; | ||
| if (x) | ||
| { | ||
|
|
@@ -1169,7 +1168,7 @@ namespace minsky | |
| } | ||
| else | ||
| { | ||
| if (rank()>1 && dimension>=y->rank()) return; | ||
| if (y->rank()>1 && dimension>=y->rank()) return; | ||
| // construct x from y's x-vector | ||
| auto tv=make_shared<TensorVal>(); | ||
| spreadX=tv; | ||
|
|
@@ -1194,13 +1193,17 @@ namespace minsky | |
| } | ||
| } | ||
| } | ||
| sumx.setArgument(spreadX,args); | ||
| auto fxy=[](double x, double y){return isfinite(x) && isfinite(y)? x*y: 0;}; | ||
| sumyy.setArgument(make_shared<BinOp>(fxy,y,y),args); | ||
| sumxx.setArgument(make_shared<BinOp>(fxy,spreadX,spreadX),args); | ||
| auto mask=[](double x, double y){return isfinite(x) && isfinite(y);}; | ||
| auto fx=[mask](double x, double y){return mask(x,y)? x:0;}; | ||
| auto fxy=[mask](double x, double y){return mask(x,y)? x*y: 0;}; | ||
| auto maskedX=make_shared<BinOp>(fx,spreadX,y); | ||
| auto maskedY=make_shared<BinOp>(fx,y,spreadX); | ||
| sumx.setArgument(maskedX,args); | ||
| sumy.setArgument(maskedY,args); | ||
| sumyy.setArgument(make_shared<BinOp>(fxy,maskedY,y),args); | ||
| sumxx.setArgument(make_shared<BinOp>(fxy,maskedX,spreadX),args); | ||
| sumxy.setArgument(make_shared<BinOp>(fxy,y,spreadX),args); | ||
| count.setArgument | ||
| (make_shared<BinOp>([](double x,double y) {return isfinite(x)*isfinite(y);},y,spreadX),args); | ||
| count.setArgument(make_shared<BinOp>(mask,y,spreadX),args); | ||
|
Comment on lines
+1196
to
+1206
|
||
|
|
||
| assert(sumx.hypercube()==sumy.hypercube()); | ||
| assert(sumx.index()==sumy.index()); | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.