Get Started with Python and AI

Get Started with Python and AI

This article is about "Get Started With Artificial Intelligence and Python". It is a part of the CodeInception session. So, for those who are interested in AI, this article will be extremely effective.

In this article, I will pretty much be talking about AI from a high level and I will do so by answering some questions so that you could better understand AI.

Table of Contents:

  • What is Artificial Intelligence?
  • Difference between Artificial Intelligence, Machine Learning, and Deep Learning
  • Why should we learn about AI
  • Which is the Best Language for Al?
  • Is Python used only in the field of AI?
  • Some of the best resources for learning Python
  • Some Libraries which are used for AI and their learning resources
  • Tensorflow vs PyTorch
  • Conclusion

What is Artificial Intelligence?

In my opinion, artificial intelligence is simply a computer trying to mimic the way humans behave or demonstrate human-like intelligence as the name suggests. Well, this could be something as simple as taking ten data points and drawing an approximate best fit line around it which we often call linear regression, or maybe something more complex like trying to find features in an image, trying to say if an image is a cat or a dog and classify it or understand the correct context of a word in a sentence. So, simply enough as I would say, making machines learn or demonstrate some form of intelligence.

Difference between Artificial Intelligence, Machine Learning, and Deep Learning

This is one of the very common questions. So, you can understand Artificial Intelligence, Machine Learning, and Deep Learning as three circles in a Venn diagram as you can see in this picture. Deep Learning is a subset of machine learning and Machine Learning is a subset of Artificial Intelligence.

art.png

I like to explain this through a sentence for each of these terms these sentences will be very similar with a single difference and it will help you to understand them easily in an intuitive way. So, we will start with Artificial Intelligence and describe it as a technique to mimic human behaviour, as we talked about it a few minutes ago.

To then define Machine Learning, we will add to our statement and now say machine learning is a technique to mimic human behaviour such that it improves with experience.

Finally, to talk about Deep Learning we will yet again add to the statement we made earlier now saying that Deep Learning is a technique to mimic human behaviour such that it improves with experience and specifically uses neural networks to do so. So in each of these, we have added a couple of new terms. I like to explain it in this way to help you better understand the differences. In case you are wondering what deep learning is at a very high level, I talked about neural networks. So neural networks are a technique in general which tries to mimic the way human brains work.

I need to say that, these may not be the formal definitions for each of the terms we described, but I tried to explain what these mean in a rather intuitive way keeping aside the formal definitions.

Why should we learn AI?

As one of my favourite professors, Andrew NG says, "AI is the new electricity" and I couldn't agree more with this. AI is pretty much being used in every single field quite extensively. You most probably are already using AI daily, for example, Google keyboard which suggests the most probable next word you are about to type based on your writing style or find similar photos in Google Photos or Gmail identifying spam emails for you and so much more. These were just a couple of areas where you most probably use AI daily, but you are most probably already using AI in multiple ways. This I think allows you to impact so many people with AI.

The reason I was drawn and started to love working with AI was due to some of the quite novel and intuitive ideas I had been introduced to while learning about AI. One such back when I was just getting started with AI was the idea of gradient descent and convex optimization. It's ok if you don't know any of these terms and I am not going too deep on any of these terms. So, I was introduced to the idea of gradient descent and convex optimization having studied calculus in my school, back then I was just blown away by such an intuitive idea. You will most probably find these topics in machine learning and you love them too.

I also believe this field is quite adaptive and constantly changing, you could just go on arxiv.com and find cool Machine Learning papers uploaded every day. I have a routine to browse arxiv.com every day and see new machine learning papers there which is just a section of the new publications or the new research in this field.

We have a new state-of-the-art model architecture for particular tasks almost every couple of months! I feel there is a lot of potential in Artificial Intelligence and something I am working on and would love to see AI getting better at is probably identifying causal inferences or causation behind decisions that AI makes.

Which is the best language for AI?

I will start by saying there is no one answer to this. You might have heard of Python being used quite a lot for AI and it indeed is one of the most popular languages to train Machine Learning models due to its vast community and a large number of libraries available to help you build AI but by no means is it the only one.

You have a lot of libraries, most prominently TensorFlowJS to train your models and deploy your Machine learning models in JavaScript on the client-side or NodeJS on the server-side. You could probably not train models right in your web browser on the client-side with Python or deploy them on the browser with Python. So, this is just one of the examples off the top of my head that I think that other languages can do a lot more than Python can do and they are also being used.

You could also use R to help you develop Machine Learning models or maybe even use TensorFlowJava and KotlinDL to create Machine Learning models using Java and Kotlin. Indeed you also have quite a few libraries in Kotlin to help you build ML models too like support for Numpy in Kotlin and so on.

So, there is no best language you would most probably end up using multiple of these. II can think of is you would probably use SQL for data warehousing and your ETL jobs, maybe use Python to train and create your models, and maybe then deploy those to run on-device in your Android Apps with Kotlin. Just a simple use case I can think of.

Is Python only used in the field of AI?

The simple answer is - No! Python is used for a lot more than just AI though it might be more popular for building AI.

Python is extensively used for data visualization, scientific computing especially due to popular libraries like Numpy, Scipy, and a lot more with domain-specific functionalities, and web development too to some extent, there are a ton of applications that use Python on the server-side and there are also some libraries to help you build backend or APIs with Python; Flask and Django being one of the most popular ones. It has also been successfully embedded in many software products as a scripting language.

In some capacity, it is also used in game development, usually for logic and server controls. So, there is a lot for which Python is used other than building AI.

Some of the best resources for learning Python

There are true quite a lot of resources to learn the basics of Python, all of them good in some aspects. A wonderful and quite popular resource I would suggest though to get started with Python would be FreeCodeCamp’s quite a popular video about getting started with Python. It could help you learn Python in a rather structured manner.

You should most certainly take a look at the Official Python documentation which is a great way to learn and is quite beginner-friendly too.

Other than that I would like to point out that you would want to explore a lot of things while learning a language by yourself, just trying to debug or solve a problem. You would learn a lot in that way. I pretty much learned Python myself, reading blogs and watching videos on the internet or you could say learning by exploring which I feel is pretty cool.

Some Libraries which are used for AI and their learning resources

There are quite a lot of libraries you could use for AI, and as I mentioned earlier this field is evolving at a very fast pace. While I was recording this just in the last twenty-four hours thirty-seven new library releases or new libraries altogether were uploaded to just PyPi which is one of the most popular Python package indexes with the topic Artificial Intelligence. Just think of it. By the way, these are the number of releases made on Sunday so you could expect even more on a normal day but anyways I think that just goes to show how fast this is evolving and you have new libraries coming up every day.

Well, Numpy, Pandas, Matplotlib, and Scikit Learn are the most commonly used libraries according to the kind of problem you are working on along with a few other ones too. So these libraries are making your work a lot easier with pre-built methods or classes.

For example, let us say you want to calculate the standard deviation of a distribution you could directly use a Numpy method to do this with one line of code. So, it often makes your life a lot easier with these open-source libraries.

To learn about any of these, I always prefer using documentation, documentation is your friend and you can know everything about any of these libraries through the documentation. Let's say I want to use matplotlib to create a scatter plot, I would most probably just search the matplotlib documentation about how to make a scatter plot and see their example code, make some modifications to their example code according to what I need. So, the greatest resource you have is the library documentation, believe me, use it!

TensorFlow vs PyTorch

I think both of these frameworks are pretty cool and do a great job at abstracting a lot of the AI aspect for you allowing you to more easily create AI applications. You may want to use specific variants for particular use cases like if you want to run your models on-device on microcontrollers or mobile devices you would probably use TensorFlow Lite and so on. Both of these have their advantages.

You might feel like PyTorch is more Pythonic and follows Python's standard about manipulating objects and TensorFlow is cool for all kinds of deployments with TensorFlow Extended and a lot more. Both of them are pretty cool in their expectations. Though on the low level both of these work with representing a dynamic acyclic graph there are some differences in how they are managed.

It is quite easy to get started with any of these frameworks, with TensorFlow you could get started in pretty much 10 minutes with the TensorFlow high-level Keras APIs. The same goes with Pytorch. You can start working with built-in modules and functions very easily.

On the same note, both of these also offer you to modify the default functionality using model subclassing in TensorFlow and using the torch.nn.Module in Pytorch and define reusable modules. So it is pretty easy to get started with both of these and simply a lot of AI parts for you.

I have seen PyTorch being quite widely accepted in research though TensorFlow is being used a lot in research too, the past two research papers I wrote were implemented with TensorFlow, and TensorFlow is often used to deploy models and also has a vibrant community.

Lastly, I strongly believe it makes more sense to learn Machine Learning concepts in greater detail and focus more on those concepts which would pretty much not change than on a particular framework. So I would recommend you or suggest you focus on machine learning concepts more than working on a specific framework.

With that I come to the end of this segment, I would encourage you to explore more about Machine learning if this sounds interesting to you. There are a ton of resources available freely to help you out and get started.

Conclusion

Finally, I would like to conclude this article with love and best wishes to all. All the best to all of them who want to start their career as Python and AI developers.



If you like this article, please share it with your friends and follow our community on social platforms to get notified about our latest activities, events, and articles. This will mean a lot ❤


An article by The AS8 Organization

Credits:


Follow us on social platforms: