Skip to content
This repository has been archived by the owner on Jul 12, 2022. It is now read-only.

My Code doesn't run with tensorscript :-( #1

Closed
Ulawun opened this issue Sep 19, 2018 · 7 comments
Closed

My Code doesn't run with tensorscript :-( #1

Ulawun opened this issue Sep 19, 2018 · 7 comments

Comments

@Ulawun
Copy link

Ulawun commented Sep 19, 2018

Hello,
Thx for sharing everything.
I can run
$ npm test
without problems :-)
When I start any *.mjs file with
$ node --experimental-modules test.mjs
beginning with
import { MultipleLinearRegression, DeepLearningRegression, } from 'tensorscript';
I get the error:
{ Error: Cannot find module tensorscript
at module.exports (internal/loader/search.js:14:12)
at Loader.exports.resolve [as resolver] (internal/loader/ModuleRequest.js:102:11)
at Loader.resolve (internal/loader/Loader.js:82:40)
at Loader.getModuleJob (internal/loader/Loader.js:112:40)
at ModuleWrap.module.link (internal/loader/ModuleJob.js:36:25)
at link (internal/loader/ModuleJob.js:34:19)
at code: 'MODULE_NOT_FOUND' }
How can I get my test.mjs running ?
Thanks.

@yawetse
Copy link
Member

yawetse commented Oct 18, 2018

Are you using node 10+?

@yawetse
Copy link
Member

yawetse commented Oct 18, 2018

Also does $ node --experimental-modules manual/examples/ex_regression-boston.mjs work for you?

@yawetse
Copy link
Member

yawetse commented Dec 15, 2018

hi @Ulawun are you still having an issue?

@Ulawun
Copy link
Author

Ulawun commented Dec 20, 2018

Hi yawetse,
Thanks a lot for having a look at the repo.
I'm using node v8.14.0 .
I'm sorry to say, that now with
$ node --experimental-modules manual/examples/ex_regression-boston.mjs
I get the error:
SyntaxError: The requested module does not provide an export named 'get'
at ModuleJob._instantiate (internal/loader/ModuleJob.js:85:17)
at

Merry Xmas,
Ulawun

@yawetse
Copy link
Member

yawetse commented Feb 15, 2019

Hi @Ulawun check out #2, you can run without using MJS just require the bundled common JS file

Example:

const TS = require('tensorscript/bundle/tensorscript.cjs');
const MultipleLinearRegression = TS.MultipleLinearRegression;
const Model = new MultipleLinearRegression({ epoch:100, });
const inputData = [
  [ 0, 0, 0, 1, ],
  [ 0, 1, 0, 0, ],
  [ 0, 0, 0, 1, ]
]; 
const outputData = [
  [ 1, ],
  [ 0, ],
  [ 1, ]
];
const predictionData = [
  [ 0, 1, 0, 0 ],
  [ 0, 0, 0, 1 ],
];

Model.train(inputData,outputData)
  .then(() => Model.predict(predictionData,{probability: false}))
  .then(predictions => {
    console.log({ predictions }) //{ predictions: [ [ 0 ], [ 1 ] ] }
  })
  .catch(err=>console.error(err));

@Ulawun
Copy link
Author

Ulawun commented Feb 18, 2019

Hi Yawetse,

Thanks a lot for your answer.
With your help I now got tensorscript to run.
After the tech. issues are solved,
I'm wondering about mathematics !

From my understanding MultipleLinearRegression
has nothing to do with training and predicting.
I think it is a kind of function approximation.
Why is in your code MultipleLinearRegression trained ?
I think MultipleLinearRegression has to have input data and then
the coefficients of a polynomial are calculated !
Did I got some mathematics wrong ?
Can I get the coefficients calculated with tensorscript ?

Thanks,
Ulawun

@yawetse
Copy link
Member

yawetse commented May 9, 2019

hi @Ulawun feel free to reach out about the math related questions. I'm going to close this issue

@yawetse yawetse closed this as completed May 9, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants