Answers.Body: <p>Your choices here are not really any different to choosing an open source library for any other purpose. Each library will have its own idiosyncratic parts, but usually these are minor things compared to:</p>
  <ul>
  <li>Is the library maintained, with recent updates, and multiple contributors?</li>
  <li>Are there compatibility issues with other parts of your project - software or hardware?</li>
  <li>Is there documentation and/or tutorials to get you started?</li>
  </ul>
  <p>Do you have to learn all the libraries? No, but if you work on multiple projects in different teams, you will probably be exposed to all the major ones anyway.</p>
  <p>When it comes to choosing between PyTorch and TensorFlow, each has its advantages for different kinds of project, but for small learning projects there's little meaningful impact. If you are just starting, pick one but be prepared to learn both pretty early on. They have loads in common anyway, so a lot of learning with one will help with the other.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-09-21T11:31:08.540Z
Answers.LastActivityDate: 2023-09-21T11:37:48.497Z
Answers.LastEditDate: 2023-09-21T11:37:48.497Z
Answers.UserDisplayName: Neil Slater
Answers.Body: <p>In short:</p>
  <ol>
  <li>Gym is complementary (but optional) to both tensorflow and pytorch. Stable-baselines (be sure to check version 3, which is based on Pytorch) supports gym natively (if I remember correctly.)</li>
  <li>Well, TensorFlow, PyTorch and Numpy are general enough to let you implement whatever ML/DL/RL workflow you wish: they are just libreries for <em>numerical computation</em>. With Numpy you would loose GPU (unless using <code>numba</code>) and TPU acceleration, but also the already build layers for neural network stuff. Anyway, I think that nowadays Pytorch is the most comprehensive since many official (and not) implementations of papers are freely available on GitHub and HuggingFace, letting you pick SOTA models easily (think about LLMs.)</li>
  </ol>
  <p>I'd like to add JAX to the list of ML frameworks, since it's gaining popularity quite fast. Differently from TF and PT, JAX is designed around the principles of functional programming like stateless functions and immutable objects. These allow to gain a more fine grained control over randomness (and so reproducibility) but also code optimizations for speedy models, although the framework can be difficult to learn initially.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-09-22T08:47:41.520Z
Answers.Text: It's good to know that I should focus more on PyTorch, as I was already leaning towards TensorFlow.
Answers.UserDisplayName: Boris L.
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-09-23T20:51:20.723Z
Answers.Text: I don't have GPU or TPU hardware capability, small-scale ML experiments I'm running locally on my laptop, for large-scale implementation I'll be using AWS cloud and LSF (yet another challenge)
Answers.UserDisplayName: Boris L.
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-09-25T09:03:27.790Z
Answers.Text: @BorisL. Well, for small ML experiments scikit-learn may be enough if you don't need neural nets, otherwise both TF and PT run also on CPU but expect larger models to run slower.
Answers.UserDisplayName: Luca Anzalone
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-09-21T13:36:16.603Z
Answers.LastActivityDate: 2023-09-25T09:07:54.180Z
Answers.LastEditDate: 2023-09-25T09:07:54.180Z
Answers.UserDisplayName: Luca Anzalone
Body: <p>I'm new to ML/AI field, and after completing several free university courses from MIT OpenCourseWare and Harvard CS50, I've gained some familiarity with the theoretical foundations of Artificial Intelligence.</p>
  <p>Now, I'm attempting to apply this knowledge by experimenting with Python examples I can find online. I've delved into various topics, spanning from Perceptrons and Nearest Neighbors to Reinforcement Learning with Q-Learning and Neural Networks. During this process, I've discovered the existence of numerous ML/AI libraries (such as scikit-learn, TensorFlow, PyTorch, Stable-Baselines, and Gymnasium/Gym) designed to facilitate programming, which is both advantageous and somewhat overwhelming.</p>
  <p>What bewilders me the most is that the same AI concepts can be implemented using different Python libraries. For instance, I've come across examples of reinforcement learning implemented using TensorFlow, PyTorch, Stable-Baselines, or just Gym combined with NumPy. This makes me wonder: which one should I choose? Is it necessary to invest my time in learning all of them?</p>
  <p>As a newcomer to this field, I'd like to gain clarity on the following:</p>
  <ol>
  <li><p><strong>Are these libraries complementary or do they compete with each
  other?</strong></p>
  </li>
  <li><p><strong>Which two libraries would provide the broadest coverage for
  AI applications?</strong> (I aim to maintain focus and limit my efforts, so becoming proficient in using only two libraries effectively would be a significant accomplishment. I'm already acquainted with the scikit-learn pipeline and find it quite appealing, but I've also noticed its limitations in the context of Reinforcement Learning and Neural Networks.)</p>
  </li>
  </ol>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2023-09-22T05:24:49.647Z
Comments.Text: Why two? If you are already familiar and comfortable with scikit-learn, a better question is probably which of the others is the best complement to scikit-learn.
Comments.UserDisplayName: tripleee
Tags: <tensorflow><pytorch><scikit-learn><stable-baselines>
Title: I'm trying to understand the use model for different Python libraries
UserDisplayName: Boris L.
ThreadText: # I'm trying to understand the use model for different Python libraries
  
  (Asked by: username_0 on 2023-09-21)
  
  I'm new to ML/AI field, and after completing several free university courses from MIT OpenCourseWare and Harvard CS50, I've gained some familiarity with the theoretical foundations of Artificial Intelligence.
  
  Now, I'm attempting to apply this knowledge by experimenting with Python examples I can find online. I've delved into various topics, spanning from Perceptrons and Nearest Neighbors to Reinforcement Learning with Q-Learning and Neural Networks. During this process, I've discovered the existence of numerous ML/AI libraries (such as scikit-learn, TensorFlow, PyTorch, Stable-Baselines, and Gymnasium/Gym) designed to facilitate programming, which is both advantageous and somewhat overwhelming.
  
  What bewilders me the most is that the same AI concepts can be implemented using different Python libraries. For instance, I've come across examples of reinforcement learning implemented using TensorFlow, PyTorch, Stable-Baselines, or just Gym combined with NumPy. This makes me wonder: which one should I choose? Is it necessary to invest my time in learning all of them?
  
  As a newcomer to this field, I'd like to gain clarity on the following:
  
  1. **Are these libraries complementary or do they compete with each
     other?**
  2. **Which two libraries would provide the broadest coverage for
     AI applications?** (I aim to maintain focus and limit my efforts, so becoming proficient in using only two libraries effectively would be a significant accomplishment. I'm already acquainted with the scikit-learn pipeline and find it quite appealing, but I've also noticed its limitations in the context of Reinforcement Learning and Neural Networks.)
  
  **Tags:** tensorflow, pytorch, scikit-learn, stable-baselines
  
  > **Comments:**
  > **username_1**: Why two? If you are already familiar and comfortable with scikit-learn, a better question is probably which of the others is the best complement to scikit-learn.  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_2 on 2023-09-21. Score: 2
  
  Your choices here are not really any different to choosing an open source library for any other purpose. Each library will have its own idiosyncratic parts, but usually these are minor things compared to:
  
  * Is the library maintained, with recent updates, and multiple contributors?
  * Are there compatibility issues with other parts of your project - software or hardware?
  * Is there documentation and/or tutorials to get you started?
  
  Do you have to learn all the libraries? No, but if you work on multiple projects in different teams, you will probably be exposed to all the major ones anyway.
  
  When it comes to choosing between PyTorch and TensorFlow, each has its advantages for different kinds of project, but for small learning projects there's little meaningful impact. If you are just starting, pick one but be prepared to learn both pretty early on. They have loads in common anyway, so a lot of learning with one will help with the other.
  
  
  ---
  
  ### Answer by username_3 on 2023-09-21. Score: 2
  
  In short:
  
  1. Gym is complementary (but optional) to both tensorflow and pytorch. Stable-baselines (be sure to check version 3, which is based on Pytorch) supports gym natively (if I remember correctly.)
  2. Well, TensorFlow, PyTorch and Numpy are general enough to let you implement whatever ML/DL/RL workflow you wish: they are just libreries for *numerical computation*. With Numpy you would loose GPU (unless using `numba`) and TPU acceleration, but also the already build layers for neural network stuff. Anyway, I think that nowadays Pytorch is the most comprehensive since many official (and not) implementations of papers are freely available on GitHub and HuggingFace, letting you pick SOTA models easily (think about LLMs.)
  
  I'd like to add JAX to the list of ML frameworks, since it's gaining popularity quite fast. Differently from TF and PT, JAX is designed around the principles of functional programming like stateless functions and immutable objects. These allow to gain a more fine grained control over randomness (and so reproducibility) but also code optimizations for speedy models, although the framework can be difficult to learn initially.
  
  > **Comments:**
  > **username_0**: It's good to know that I should focus more on PyTorch, as I was already leaning towards TensorFlow.  
  > **username_0**: I don't have GPU or TPU hardware capability, small-scale ML experiments I'm running locally on my laptop, for large-scale implementation I'll be using AWS cloud and LSF (yet another challenge)  
  > **username_3**: @BorisL. Well, for small ML experiments scikit-learn may be enough if you don't need neural nets, otherwise both TF and PT run also on CPU but expect larger models to run slower.  
  
  ---
  
  