You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
classLinearRegression{w: Mat;constructor(){}//x: M-by-N matrix. M data with N dimensions. Each row is an N-dim vector//y: M-by-1 matrixfit(x_: Mat,y_: Mat) : LinearRegression{lety=y_;if(y_.rows!=1&&y_.cols==1){y=y_.T();}//check the dimension of yvarx=x_.resize(x_.rows,x_.cols+1,1);//expan x_ with one more column with 1this.w=((X.T()*X)^-1)*X.T()*y//calculate w = (X.T() * X)^-1 * X.T() * yreturnthis;}//x: M-by-N matrix. M data with N dimensions. Each row is an N-dim vectorpredict(x_: Mat):mat{letx=x_.resize(x_.rows,x_.cols+1,1);//expan x_ with one more column with 1returnx*(this.w);}}
and user can import and use the library in this way:
Users can temporally or permanently save their libraries on github gist, or github repo, or build their own code management server on their own hand.
Notes:
The differences between (1) and (2) is that the babel compiler should also compile the hedgehog script in (2) with user's input code together before executing, but not for the common JavaScript module in (1). So it's necessary to split dependencies (1) and (2), compile (2) with user's code first, then add "import" part of (1) before execution;
A straight-forward idea for implementing (2) is just concatenating all raw strings of libraries into a single chunk of code before compiling. For example:
Is your feature request related to a problem? Please describe.
Yes we absolutely need a way to allow user to import codes/modules/libraries via package management.
Describe the solution you'd like
1. Allow user to use import(LIB_URL) to import library
2. Allow user to fetch a hedgehog script/library from url, including
For example, the library "linearRegression" code is hosted by Github Gist at https://gist.githubusercontent.com/lidangzzz/a14456264724a92b5a1147036537e531/raw/e0bb0e1f5f763ca076ef726be73e3bcc98f048bd/linearRegression.hhs
and user can import and use the library in this way:
Users can temporally or permanently save their libraries on github gist, or github repo, or build their own code management server on their own hand.
Notes:
The differences between (1) and (2) is that the babel compiler should also compile the hedgehog script in (2) with user's input code together before executing, but not for the common JavaScript module in (1). So it's necessary to split dependencies (1) and (2), compile (2) with user's code first, then add "import" part of (1) before execution;
A straight-forward idea for implementing (2) is just concatenating all raw strings of libraries into a single chunk of code before compiling. For example:
Lib1.hss
Lib2.hss
user's input code
And after fetching the libraries by traversing the dependency tree and concatenating all scripts, the code for compiling is
Describe alternatives you've considered
No
Additional context
No
The text was updated successfully, but these errors were encountered: