We have the answers to your questions! - Don't miss our next open house about the data universe!

Framework : What is it and why is it used for?

- Reading Time: 4 minutes
framework

This is a word we often use in IT, but what exactly is it ? A framework is a conceptual or real structure that you can build on for IT projects, It simplifies their design. We will explore this concept in this article.

We just mentioned “IT projects“, which also means computer science. By using these terms, we also have to mention “programming language”. Let’s see what the differences are ?

Framework and programming language

Let’s take the example of the famous programming language Python. Thanks to this tool, we can make games, mathematical calculations, collect data from the web or web-scraping, or make artificial intelligence. The possibilities are endless. As a fan of data science, I decided to make my own neural network.

However, we need to implement the initialization of the neural weights, the activation function and the gradient descent. We can do it, but it is very tedious. A real ordeal for any beginner in data science, should I abandon my project?

Fortunately, frameworks exist and save me from building the entire neural network. Thanks to this tool, I have an operational neural network in a split second, I only have to parameterize the model to my data. 

Here is the main interest of a framework, to give a basic structure to our application that avoids us to build from scratch our applications. Moreover, frameworks are not only reserved for data science, they are also used for web development, but also for mobile development.

What are the most used frameworks?

Here are some examples of frameworks widely used in web programming:

  • In Python, the 2 most used frameworks are Django and Flask. We find the first one for the social network Instagram and the second for Linkedin and Pinterest. 
  • For Javascript, one of the most common languages in web development, we have Angular, which is behind the Netflix site. 
  • Finally, in the trendy language Ruby, there is Ruby on Rails, which is used for the rental site AirBnb but also for the live-streaming service Twitch or for the famous code hosting platform: Github.

 

Here are some examples of frameworks that are very popular in the field of Data Science:

  • TensorFlow is a Python framework made by Google’s team, widely used in the industry, as it is one of the first to enter the market.
  • PyTorch is a framework that is becoming more and more popular, as it is easier to use than TensorFlow. We use it especially in the search world.

 

Frameworks are designed by experts, which ensures the reliability of the code and even large groups use them, so why deprive themselves ? Moreover, using frameworks, you are guaranteed to find help on how the functions work. You’ll find it easier to find questions on how to use a framework, with online documentation, but also with Stackoverflow, an impressive forum.

In the end, why not learn a framework directly instead of a language ? You will say that since the framework saves us a lot of time, it would be better to learn only the framework.

However, let’s not forget that a framework uses a programming language as a foundation, so if we have a usage error related to the language without mastering it, it can be annoying.

Hence the importance, before using a framework, of knowing how to handle the programming language used.

Finally, nobody prevents you from doing your own neural network implementation from scratch. It will even be highly valued (I advise you to put it on your CV) but you will have to allocate much more time and it depends on your project.  

The explanation of a framework is very similar to another word that we often find in the lexical field of software development, the library.

Framework vs library, Which one is right?

There is a difference between the two terms that we will explain.With Python, It is normal to take a look at the execution time of a function to determine its efficiency. 

To do this, we use the “timeit” function from the timeit library. In this case we measure the execution time of a function we choose.

Now, let’s assume that in our preferred Data Science framework, we can measure the learning time of our neural networks. However, in our imported libraries, there is no “timeit library” and yet, when we use the neural networks in the framework, we have the learning time without having asked for it. We call this Inversion of Control (IoC).

It is not the user who calls the timeit function from his code, but it is the framework that uses the timeit function, independently of the program.

Finally, we can say that a framework is much more sophisticated than a library, since in its operation it uses libraries without the user explicitly asking for it.

Conclusion

Thus, we keep in mind that a framework simplifies the use of programming languages. This tool allows us to rewrite unimportant functionalities of our applications and to export programs more easily for different uses. 

Moreover, since frameworks are created by experts, they are recognized in the working world for their reliability. This large set of users ensures that we can find help on our models more easily than when we make them ourselves. 

If you want to learn how to use the Flask or TensorFlow frameworks, or even the Python language, feel free to check out our Data Scientist training courses.

You are not available?

Leave us your e-mail, so that we can send you your new articles when they are published!
icon newsletter

DataNews

Get monthly insider insights from experts directly in your mailbox