PySyft icon indicating copy to clipboard operation
PySyft copied to clipboard

Removing the sklearn dependency

Open jvmncs opened this issue 7 years ago • 8 comments

Currently, there's a scikit-learn dependency for PySyft, however it's only being used in two places -- the create_sandbox feature in sandbox.py, which loads a few datasets from sklearn, and a tutorial on federated learning where it's being used as a shortcut to calculating ROC. This seems like a heavy dependency for accomplishing such simple and standard tasks. Removing it would improve build times and lessen the code surface area for e.g. enterprise audits.

In order to remove the dependency, we need to fix the two code snippets that mention it:

  • The federated learning tutorial can have a note suggesting that the user install sklearn to follow along.
  • The sandbox is only slightly more involved. I suggest we add an exception catch for ImportError around any sklearn imports -- if the ImportError is caught, we print a friendly reminder to install sklearn in order to use the sandbox.

jvmncs avatar Aug 20 '19 17:08 jvmncs

I would like to take on/be assigned this issue.

kakirastern avatar Aug 24 '19 17:08 kakirastern

Hi, sorry! I have actually tackled this issue in an unsubmited PR for installing PySyft with different frameworks (torch, TFE keras, and tensorflow so far). I'm still waiting to polish it before submitting, but should be in early this week.

On Sat, Aug 24, 2019, 1:37 PM Kris Stern [email protected] wrote:

I would like to take on/be assigned this issue.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/OpenMined/PySyft/issues/2535?email_source=notifications&email_token=AB4GTBNUDSORVI4TA3B6P7DQGFWWLA5CNFSM4IN2LXFKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD5CEN7Y#issuecomment-524568319, or mute the thread https://github.com/notifications/unsubscribe-auth/AB4GTBODK2B3SSVMTZFEJ3DQGFWWLANCNFSM4IN2LXFA .

jvmncs avatar Aug 24 '19 22:08 jvmncs

No worries @jvmancuso

kakirastern avatar Aug 24 '19 22:08 kakirastern

@jvmancuso What do you think about completely removing sklearn dependency (instead of throwing Import Error) and in-place of that use torchvision like module for loading datasets?

If this sounds good I can make required changes for that?

Ankit-Dhankhar avatar Sep 06 '19 03:09 Ankit-Dhankhar

Hm -- on the one hand, I like the idea of moving to torchvision because the datasets are a bit less trivially solved than the ones in sklearn. On the other hand, we're moving away from having pytorch be a required dependency (see for example this RFC and these PRs). Similarly, one might want to create a TF version of the sandbox in the PySyft-TensorFlow repo once that code is ready.

I think we should keep the sklearn sandbox here for now, since people seem to use it. But I also think once we move the frameworks out to PySyft-PyTorch and PySyft-TensorFlow, those repos might want to have their own versions of the sandbox that are a bit more suitable for experimenting with deep learning.

What do you think?

jvmncs avatar Sep 06 '19 14:09 jvmncs

Hi @jvmancuso Is this issue still open? I would like to be assigned to this if no one is currently working on it.

ribhu97 avatar Dec 11 '19 05:12 ribhu97

Is this still open?

agarwalmanvi avatar Feb 24 '20 20:02 agarwalmanvi

Hey all, this was finished as a result of https://github.com/OpenMined/PySyft/pull/2636

Going to close this, feel free to open up a new issue if there are any further concerns!

jvmncs avatar Feb 25 '20 13:02 jvmncs