[Gsoc] Machine Learning Toolbox : An alternative approach

classic Classic list List threaded Threaded
20 messages Options
Philippe Saadé (ESI INENDI) Philippe Saadé (ESI INENDI)
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[Gsoc] Machine Learning Toolbox : An alternative approach

Dear all,

After intense discussions and technology exploration, I would like to expose in this email another approach that, I think, has many advantage over the one that is currently being followed.

To summarize a bit the current approach, I would say that we are trying to let Scilab users access the existing portfolio of ML framework through the existing PIMS package of Scilab.
This implies wrapping as many python-based functions as possible to allow individual usage in Scilab. This also implies to manage object conversion from/to Scilab to/from Python.

To me, this approach looks unsustainable, due to the high number of functions in each relevant ML framework, and their constant evolutions.
 I do not feel comfortable to let Mandar invest his time during this GSoC to produce something that is not credible on the long run.

Therefore, I would like to propose another approach.
This one is based on a Server-Client approach, as demonstrated in any Jupyter Notebook implementation.
If we consider that the Python engine is being provided by a Jupyter server (probably an adapted version of the iPython jupyter-kernel), then Scilab only needs an adapted version of the Jupyter-client to allow efficient usage of Python from within Scilab.

As soon as we have listed the type of objects we will have to exchange between Scilab and Python (probably a lot have already been identified by PIMS, and probably have functional conversions routines..) we can exploit nearly all of Python classes and packages with Python code, and Scilab code, augmented by conversions' routines.
Such an approach would allow Mandar to focus on object type conversions and that would allow him (and us) to explore more than one ML framework at the same time. In the scope of Data Science, we could cover :Scikit Learn, Pandas, Keras, numpy, SciPy, etc.
If not 100%, at least we would have strengthened Scilab with a "natural" connexion  to many famous ML libraries.

In my team, Justin can provide an example of Python code that connects to a Jupyter_server and executes python code.

@Mandar : i think you can master the important topics of Jupyter pretty quickly and develop a prototype, to serve as a Proof of Concept.
Would you be OK to work on that full time next week ?

Thanks and enjoy the WE.

--

 

Cordialement – Best regards,

 

Philippe SAADÉ
Directeur Business Unit « Big Data Analytics » – ESI Group

 

ESI Group | 70 rue Robert | 69458 Lyon | France

Direct: +33 (0)4 78 14 12 16 – Cell: +33 (0)6 18 64 44 92 – Main: +33 (0)4 78 14 12 26

 

Email: [hidden email] – Skype: psaade.tel --- Be green : think before you print!

www.esi-group.com

 


_______________________________________________
gsoc mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/gsoc
mandroid6 mandroid6
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [Gsoc] Machine Learning Toolbox : An alternative approach

Yes, I think this would be the best approach to follow right now.

I will be working full-time to have an overall understanding of Jupyter till Thursday i.e 22nd June, and then start developing the prototype in the last 3 days of the week.

Also, I needed a bit more clarity regarding the prototype - Should it act as a working example of messaging protocol mentioned in the Jupyter documentation? Or directly it should working through SCILAB interface?

Thanks
Philippe Saadé (ESI INENDI) Philippe Saadé (ESI INENDI)
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Machine Learning Toolbox : An alternative approach

Hi Mandar,

Justin, in my team, will share with us a sample code that should help you start quickly.
This is some sort of Minimal Working Example.

Regarding the "prototype", I would like to submit a very simple case.
Suppose we want to solve the following problem : we want to solve, over I=[-1,1], the differential equation y'(t)=a(t)y(t) where a(t) is a [-1,1]--> IR function that has to be learned from a basic regression of a dataset D=(t_i, a_i), with all t_i in [-1,1].
(for the regression, we can generate an approximation of a Sin function with a basic noise perturbation.)

We should have a native Python code being sent to the Jupyter server and a way to capture the learned function "a" from the python context to the Scilab context (is this already solved in PIMS (if yes, that's fine ! We copy the approach). And then we should have a Scilab code to solve the differential equation.

Measuring how much is done by the end of the week will be a good way to measure the feasibility of this global approach.

What do you think ?

 

Cordialement – Best regards,

 

Philippe SAADÉ
Directeur Business Unit « Big Data Analytics » – ESI Group

 

ESI Group | 70 rue Robert | 69458 Lyon | France

Direct: +33 (0)4 78 14 12 16 – Cell: +33 (0)6 18 64 44 92 – Main: +33 (0)4 78 14 12 26

 

Email: [hidden email] – Skype: psaade.tel --- Be green : think before you print!

www.esi-group.com

 

Le 19/06/2017 à 11:22, mandroid6 a écrit :
Yes, I think this would be the best approach to follow right now.

I will be working full-time to have an overall understanding of Jupyter till
Thursday i.e 22nd June, and then start developing the prototype in the last
3 days of the week.

Also, I needed a bit more clarity regarding the prototype - Should it act as
a working example of messaging protocol mentioned in the Jupyter
documentation? Or directly it should working through SCILAB interface?

Thanks




--
View this message in context: http://mailinglists.scilab.org/Gsoc-Machine-Learning-Toolbox-An-alternative-approach-tp4036586p4036594.html
Sent from the Scilab / GSOC - Mailing Lists Archives mailing list archive at Nabble.com.
_______________________________________________
gsoc mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/gsoc


_______________________________________________
gsoc mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/gsoc
mandroid6 mandroid6
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Machine Learning Toolbox : An alternative approach

Hello sir,

Sorry but i didn't clearly understand the problem to be solved.
Correct me if I got it wrong.

1. We first need to create a dataset using the given conditions (t and i) and
2. get a regression model for the same using the jupyter server and the sample code shared by Justin sir.
3. Once we receive the regression model in terms of 'a', it should be converted to SCILAB context
4. which would then be used to solve the differential equation .

So is the sin function being used for 'y(t)' for creating the dataset?




Philippe Saadé (ESI INENDI) Philippe Saadé (ESI INENDI)
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Machine Learning Toolbox : An alternative approach

Hello Mandar,

I thought it would be easier to generate the dataset with a noisy Sin based signal.
Therefore, the regression fonction a(t) should look like a Sin.
Then we can check the look of y(t) after integration.

Please adapt to your taste ;-)

Philippe

Envoyé de mon mobile

> Le 19 juin 2017 à 17:04, mandroid6 <[hidden email]> a écrit :
>
> Hello sir,
>
> Sorry but i didn't clearly understand the problem to be solved.
> Correct me if I got it wrong.
>
> 1. We first need to create a dataset using the given conditions (t and i)
> and
> 2. get a regression model for the same using the jupyter server and the
> sample code shared by Justin sir.
> 3. Once we receive the regression model in terms of 'a', it should be
> converted to SCILAB context
> 4. which would then be used to solve the differential equation .
>
> So is the sin function being used for 'y(t)' for creating the dataset?
>
>
>
>
>
>
>
>
> --
> View this message in context: http://mailinglists.scilab.org/Gsoc-Machine-Learning-Toolbox-An-alternative-approach-tp4036586p4036600.html
> Sent from the Scilab / GSOC - Mailing Lists Archives mailing list archive at Nabble.com.
> _______________________________________________
> gsoc mailing list
> [hidden email]
> http://lists.scilab.org/mailman/listinfo/gsoc
_______________________________________________
gsoc mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/gsoc
mandroid6 mandroid6
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Machine Learning Toolbox : An alternative approach

Okay sir,
I will continue with geting a grasp over how jupyter works for teh next 2-3 days.
Then will start working on the prototype. Type of signal to be considered can be decided then.

Will post any other doubt as I encounter them.

Mandar
mandroid6 mandroid6
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Machine Learning Toolbox : An alternative approach

This post was updated on .
In reply to this post by Philippe Saadé (ESI INENDI)
Hello Sir,

I have been reading through the jupyter_client documentation, and am gradually understanding how to works.
The sample code sent to me by Justin from your team also works fine, I tried it myself.

I still have major doubts about how we are going to call jupyter from within Scilab.
Is it possible to have an exchange tomorrow so that I could clear all my doubts about the approach at once?
Because even though I have been working and understanding the documentation given, still I am a bit confused about the approach.

Thanks.

Philippe Saadé (ESI INENDI) Philippe Saadé (ESI INENDI)
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Machine Learning Toolbox : An alternative approach

Hello Mandar,

Of course, I will be available at some point this morning (CET). Let me know if it suits your time.

We will then summarize the discussion in the list so that everything can be discussed publicly.

 

Cordialement – Best regards,

 

Philippe SAADÉ
Directeur Business Unit « Big Data Analytics » – ESI Group

 

ESI Group | 70 rue Robert | 69458 Lyon | France

Direct: +33 (0)4 78 14 12 16 – Cell: +33 (0)6 18 64 44 92 – Main: +33 (0)4 78 14 12 26

 

Email: [hidden email] – Skype: psaade.tel --- Be green : think before you print!

www.esi-group.com

 

Le 20/06/2017 à 19:26, mandroid6 a écrit :
Hello Sir,

I have been reading through the jupyter_client documentation, and am
gradually understanding how to works.
The sample code sent to me by Justin from your team also works fine, I tried
it myself.

I still have major doubts about how we are going to call the jupyter from
within Scilab. 
Is it possible to have an exchange tomorrow so that I could clear all my
doubts about the approach at once?
Because even though I have been working and understanding the documentation
given, still I am a bit confused about the approach.

Thanks.





--
View this message in context: http://mailinglists.scilab.org/Gsoc-Machine-Learning-Toolbox-An-alternative-approach-tp4036586p4036613.html
Sent from the Scilab / GSOC - Mailing Lists Archives mailing list archive at Nabble.com.
_______________________________________________
gsoc mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/gsoc


_______________________________________________
gsoc mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/gsoc
mandroid6 mandroid6
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Machine Learning Toolbox : An alternative approach

Yes sir,

I am available right now. Any time suits me.
mandroid6 mandroid6
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Machine Learning Toolbox : An alternative approach

In reply to this post by Philippe Saadé (ESI INENDI)
Hello all,

After today's discussion with Philippe sir regarding the jupyter-client approach, following important points were highlighted:

1. Its essential to know that, we are not planning to have an interactive python environment within Scilab, as it would be unfeasible to manage so many libraries and versions in an efficient manner

2. Python scripts will be written outside Scilab interface, and would be called to work only when their outputs or trained machine learning models need to be used in Scilab context.

3. This would involve the following steps
     1. Writing the required machine learning script and saving it as a '.py' file.
     2. Sending the ml script created to the python kernel running on jupyter server.
     3. Once execution completes, passing back the python objects like regression model to Scilab and  converting it to Scilab context.
     4. This converted object can then be used for solving any required operation through Scilab like a differential equation.

4. Two major parts of this approach are :

    [1] Passing the python script file to the jupyter server, and/or letting the python kernel to know where this file exists
    [2] Conversion of python objects to Scilab compatible form

Part [1] involves, passing the path of the script file to the jupyter server so that the python kernel can execute it. This can be achieved through python code for transferring/copying the script file to python kernel path.
Even if we decide to follow the PIMS approach or continue working on this jupyter server method, we would be required to handle part [2].


So the major focus for me right now would be to work out a way to have python objects converted to Scilab context, and using them to solve a simple Scilab native operation like differentiation.


Clément David-3 Clément David-3
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Machine Learning Toolbox : An alternative approach

Hello Mandar,

Quick note about :
> [2] Conversion of python objects to Scilab compatible form

These conversions are done in PIMS src/cpp/ScilabPythonEnvironmentWrapper.cpp ; each python data
type is converted from Python to Scilab in operations called `wrap` and from Scilab to Python in
operations called `unwrap`.

Thanks,

--
Clément
_______________________________________________
gsoc mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/gsoc
Philippe Saadé (ESI INENDI) Philippe Saadé (ESI INENDI)
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Machine Learning Toolbox : An alternative approach

Hello Clément,

I didn't have the opportunity to take a look at the documentation or browse in the source code: could you provide a list of supported object types ?

My concern is about the specific data types that are being manipulated by the popular ML frameworks.

In all cases, we will have to convert these types to something meaningful in Scilab. So, I think it is probably a valid choice to mutualize the work and augment the PIMS module.

Thanks.

 

Cordialement – Best regards,

 

Philippe SAADÉ
Directeur Business Unit « Big Data Analytics » – ESI Group

 

ESI Group | 70 rue Robert | 69458 Lyon | France

Direct: +33 (0)4 78 14 12 16 – Cell: +33 (0)6 18 64 44 92 – Main: +33 (0)4 78 14 12 26

 

Email: [hidden email] – Skype: psaade.tel --- Be green : think before you print!

www.esi-group.com

 

Le 22/06/2017 à 11:57, Clément David a écrit :
Hello Mandar,

Quick note about :
[2] Conversion of python objects to Scilab compatible form
These conversions are done in PIMS src/cpp/ScilabPythonEnvironmentWrapper.cpp ; each python data
type is converted from Python to Scilab in operations called `wrap` and from Scilab to Python in
operations called `unwrap`.

Thanks,

--
Clément
_______________________________________________
gsoc mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/gsoc


_______________________________________________
gsoc mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/gsoc
Clément David-3 Clément David-3
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Machine Learning Toolbox : An alternative approach

Hello Philippe,

> could you provide a list of supported object types ?
>
> My concern is about the specific data types that are being manipulated by the popular ML
> frameworks.

From my knowledge, the source code is the main reference ; feel free to browser it [1]. Native
datatypes as well as Numpy ones might probably be supported.

For specific data types, if constructible from Python or Numpy values it is possible to re-use the
constructors for free. For example, pandas.DataFrame [2] can be allocated using ndarrays or pyDict
of pandas.Series.

[1]: https://forge.scilab.org/index.php/p/pims/source/tree/master/src/cpp/ScilabPythonEnvironmentWra
pper.cpp
[2]: https://pandas.pydata.org/pandas-docs/stable/dsintro.html#dataframe

Regards,

--
Clément
_______________________________________________
gsoc mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/gsoc
mandroid6 mandroid6
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Machine Learning Toolbox : An alternative approach

Hello all,


Thanks Clement sir for the sharing this info.

The main obstacle is not just the coversion of native python objects like lists or dict, which have already been done through pyDict and the pyWrap and pyUnrap methods.
What we are trying to achieve here is to have the trained ml models to be transfered to Scilab in a form, which can be reused for other operations within scilab.

So even if at this stage data types can be coverted, there needs to be a way for SCILAB to interpret the trained ml models.
mandroid6 mandroid6
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Machine Learning Toolbox : An alternative approach

Hello everyone,

Following last weeks discussion, I have been trying to find a way to convert trained ml models in scikit-learn to Scilab context.

While reading more about how this could be achieved, I have found a useful python lib sklearn-porter. It has the ability to convert trained ml models to C, Java, JavaScript and others. Since Scilab macros can be written as around C code, it would be useful to try out this method.

python model creation --> training --> convert to C code using sklearn-porter --> write wrappers around the C code so that it can be used in Scilab

What do you think? Please suggest.

Thanks
Philippe Saadé (ESI INENDI) Philippe Saadé (ESI INENDI)
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Machine Learning Toolbox : An alternative approach

Hello Mandar,

This is an interesting finding.

The use case, however, is probably not suited for "dynamic" usage of Python and immediate update of the converted object in Scilab.
I guess this approach would be interesting when a model has been fully trained and tested, and when one has particular needs of performance. Then, converting to C and wrapping it from within Scilab could be interesting.
Correct me if I am wrong : this would require user collaboration and would not be doable "in the background"?

The other remark I have is that this approach would be limited to Scikit Learn and would not apply to other Python-based ML frameworks (Keras, Pandas, etc.).

My advice would be to keep the "sklearn-porter" in mind but stick with the problem of convertion of complex ML objects from Python to Scilab.

What do you think ?

 

Cordialement – Best regards,

 

Philippe SAADÉ
Directeur Business Unit « Big Data Analytics » – ESI Group

 

ESI Group | 70 rue Robert | 69458 Lyon | France

Direct: +33 (0)4 78 14 12 16 – Cell: +33 (0)6 18 64 44 92 – Main: +33 (0)4 78 14 12 26

 

Email: [hidden email] – Skype: psaade.tel --- Be green : think before you print!

www.esi-group.com

 

Le 26/06/2017 à 07:21, mandroid6 a écrit :
Hello everyone,

Following last weeks discussion, I have been trying to find a way to convert
trained ml models in scikit-learn to Scilab context.

While reading more about how this could be achieved, I have found a useful
python lib sklearn-porter. It has the ability to convert trained ml models
to C, Java, JavaScript and others. Since Scilab macros can be written as
around C code, it would be useful to try out this method.

python model creation --> training --> convert to C code using
sklearn-porter --> write wrappers around the C code so that it can be used
in Scilab

What do you think? Please suggest.

Thanks



--
View this message in context: http://mailinglists.scilab.org/Gsoc-Machine-Learning-Toolbox-An-alternative-approach-tp4036586p4036659.html
Sent from the Scilab / GSOC - Mailing Lists Archives mailing list archive at Nabble.com.
_______________________________________________
gsoc mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/gsoc


_______________________________________________
gsoc mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/gsoc
Philippe Saadé (ESI INENDI) Philippe Saadé (ESI INENDI)
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Machine Learning Toolbox : An alternative approach

Hello again,

I have something else to add.
If you take a look at one of Scikit Learn source file, as the one for Ridge Regression : https://github.com/scikit-learn/scikit-learn/blob/master/sklearn/linear_model/ridge.py
It is not to hard to see that most returned objects are just plain Numpy objects.

This should be easily convertible to Scilab.
What do you think ?

 

Cordialement – Best regards,

 

Philippe SAADÉ

 

 

Le 26/06/2017 à 08:08, Philippe Saadé (ESI INENDI) a écrit :
Hello Mandar,

This is an interesting finding.

The use case, however, is probably not suited for "dynamic" usage of Python and immediate update of the converted object in Scilab.
I guess this approach would be interesting when a model has been fully trained and tested, and when one has particular needs of performance. Then, converting to C and wrapping it from within Scilab could be interesting.
Correct me if I am wrong : this would require user collaboration and would not be doable "in the background"?

The other remark I have is that this approach would be limited to Scikit Learn and would not apply to other Python-based ML frameworks (Keras, Pandas, etc.).

My advice would be to keep the "sklearn-porter" in mind but stick with the problem of convertion of complex ML objects from Python to Scilab.

What do you think ?

 

Cordialement – Best regards,

 

Philippe SAADÉ
Directeur Business Unit « Big Data Analytics » – ESI Group

 

ESI Group | 70 rue Robert | 69458 Lyon | France

Direct: +33 (0)4 78 14 12 16 – Cell: +33 (0)6 18 64 44 92 – Main: +33 (0)4 78 14 12 26

 

Email: [hidden email] – Skype: psaade.tel --- Be green : think before you print!

www.esi-group.com

 

Le 26/06/2017 à 07:21, mandroid6 a écrit :
Hello everyone,

Following last weeks discussion, I have been trying to find a way to convert
trained ml models in scikit-learn to Scilab context.

While reading more about how this could be achieved, I have found a useful
python lib sklearn-porter. It has the ability to convert trained ml models
to C, Java, JavaScript and others. Since Scilab macros can be written as
around C code, it would be useful to try out this method.

python model creation --> training --> convert to C code using
sklearn-porter --> write wrappers around the C code so that it can be used
in Scilab

What do you think? Please suggest.

Thanks



--
View this message in context: http://mailinglists.scilab.org/Gsoc-Machine-Learning-Toolbox-An-alternative-approach-tp4036586p4036659.html
Sent from the Scilab / GSOC - Mailing Lists Archives mailing list archive at Nabble.com.
_______________________________________________
gsoc mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/gsoc



_______________________________________________
gsoc mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/gsoc
mandroid6 mandroid6
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Machine Learning Toolbox : An alternative approach

This post was updated on .
In reply to this post by Philippe Saadé (ESI INENDI)
Yes, I had initially thought about adding a common python command for conversion from python to C code. But no this is not 'dynamic', it would involve user collaboration for C --> Scilab. Also currently sklearn-porter currently supports only a few ml algorithms.

About the Ridge Regression, yes Numpy objects can easily be converted to scilab. Once returned these objects would be usable directly as matrices.

Would this be useful enough, if the returned objects are usable but not the methods associated with that object?
mandroid6 mandroid6
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Machine Learning Toolbox: Jupyter Approach

Hello all,

For covering examples which can be demonstrated through the jupyter approach, I have investigated the source code of the following models:

1. Linear Regression
2. Ridge Regression
3. Kernel Ridge Regression
4. SVR
5. KMeans Clustering

Also have written the PIMS implementation of the model's examples, along with the original python script. These have been committed on the forge at this [[http://forge.scilab.org/index.php/p/machine-learning-toolbox/source/tree/master/Integration%20Approach/PIMS_python_compare|link]].

All these model attributes have been retrieved from the Jupyter server in the python implementation.
For the transfer of learned model attributes from jupyter server to the local machine, I have considered using 'pickle' library to store the numpy objects in a '.p' file.Here are few rough steps to achieve this:
 
1. After training is complete and attributes.p file is saved on remote server.
2. The pickle file will be transferred to the local machine at a location specified using the IP and working directory of the local machine.
3. Here the python_local.py will extract the attributes from the pickle file
4. and send these attributes to Scilab.

So pickle will be able to handle steps 1 and 3 mentioned above.
For now I have read the pickle usage documentation for saving and loading python objects in different python instance. And was able to demonstrate this for ML model attributes through the kernel_ridge regression example. I have committed the sample code [[http://forge.scilab.org/index.php/p/machine-learning-toolbox/source/tree/master/Integration%20Approach/Jupyter_Approach/Storage|here]].

For step 2, we need to use a ssh protocol for sending the pickle file back to the local machine. For this I was considering usage of a python package like [[http://www.paramiko.org/|paramiko]] or [[http://www.fabfile.org/|fabric]] for it.

In the discussion with Philippe Saade about these protocols, "sshfs" was suggested if both client and server machines are linux based. But in my case I have a Windows and a Linux machine , so it would be better to use Samba on the server and allow folder sharing, as Philippe suggested. Also this would be more suitable for the general usage of Scilab by Windows and Linux users alike.
I will reading more about them this weekend, along with covering more scikit-learn classes for the jupyter approach.

As for the PIMS load errors, I have reported all issues to Simon and he is looking into it. We had a long troubleshooting session yesterday, still there are few errors in loader.sce, which he is resolving.

Regards
Mandar Deshpande
mandroid6 mandroid6
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[GSoC] Machine Learning In Scilab: Jupyter Approach

Hello All,

It seems there was some error in locating the python27.dll file in the python installation path, for loading PIMS. After successfully building and loading the PIMS/scipython toolbox with help from Simon Marchetto, the project has got a significant boost.

Up until now, I was able to run a local python script for training ml models on a jupyter server and save the learned attributes in a pickle file.This pickle file was later used to extract the attributes from a different python instance using 'load' method from pickle library.

Now using scipython, I am able to execute a single ml_scilab.sce file which does the following:

 1. Imports pickle, numpy and python builtin libraries using pyImport
 2. Runs the pyExecFile function from scipython, which executes a local_ml python script
 3. This local_ml script trains the machine learning model and saves the attributes in a pickle file - 'attributes.p'
 4. The ml_scilab.sce file waits for 3 seconds for the creation of the pickle file
 5. Once the 'attributes.p' file is created, it is loaded in Scilab using the load method and saved in a variable 'abc'
 6. This 'abc' variable storing all attributes values, is used to extract individual attributes using index addressing eg. coef_ = abc(0); intercept_ = abc(1)

I have committed the code [[http://forge.scilab.org/index.php/p/machine-learning-toolbox/source/tree/master/Integration%20Approach/Jupyter_Approach/ml_scilab.sce|here]].


So now we can train any machine learning model through Scilab and get the learned attributes back to the Scilab Console for further usage.

The part remaining is to do this training on a remote server, where the computing power and datasets would be present.
The python script responsible for handling the jupyter_server communication has been tested and working on the python side i.e.
 
 1. python_local.py opens a communication channel with a Jupyter server, with an IPython kernel running on it
 2. It sends a 'execfile()' command to the jupyter server for executing the machine learning script(python_server_lr.py) present on the server
 3. Attributes after training are saved in a pickle file
 4. This pickle file is imported in python, to extract all learned attributes.

But when the jupyter server is being tried to run through Scilab the following error is generated :
 
UserWarning: Unexpected error discovering local network interfaces: 'module' object has no attribute 'STARTF_USESHOWWINDOW'
  warn("Unexpected error discovering local network interfaces: %s" % e)

Once this issue is resolved, we can have a working example to show working of the Jupyter approach.

Regards
Mandar Deshpande
Loading...