├── .gitignore ├── CONTRIBUTING.md ├── LICENSE ├── README.md ├── assets └── Logos & Favicon │ ├── CDC High Resolution Circle Logo Transparent Background.png │ ├── CDC High Resolution Circle Logo.jpg │ ├── CDC New High Resolution Logo Circle.png │ ├── CDC New High Resolution Logo Option 2.png │ ├── CDC New High Resolution Logo.png │ ├── github.png │ └── icons8-community-96.png ├── docs └── Project_Setup.md ├── index.html ├── package-lock.json ├── package.json ├── postcss.config.cjs ├── src ├── App.jsx ├── Components │ ├── Navbar.jsx │ └── Search.jsx ├── Constants │ └── index.js ├── Python │ ├── CodeEditor.jsx │ ├── PlayGround copy.jsx │ ├── PlayGround.jsx │ └── Scripts.jsx ├── Python_Library_Pages │ ├── AllApps.jsx │ ├── Flask │ │ └── Introduction-to-flask.jsx │ ├── Matplotlib │ │ └── Intro-to-Matplotlib.jsx │ ├── Numpy │ │ └── Intro-to-Numpy.jsx │ ├── PYQT │ │ └── Introduction-to-PYQT.jsx │ ├── Pandas │ │ └── Intro-to-Pandas.jsx │ ├── Python_Basics │ │ ├── Intrduction-to-Operators.jsx │ │ ├── Introduction-to-Functions.jsx │ │ └── Introduction-to-Python.jsx │ ├── Scikit-Learn │ │ └── Intro-to-ScikitLearn.jsx │ ├── Seaborn │ │ ├── Assets │ │ │ ├── Fig1.png │ │ │ ├── Fig2.png │ │ │ └── Fig3.png │ │ └── Introduction-to-Seaborn.jsx │ ├── TensorFlow │ │ └── Introduction-to-tensorFlow.jsx │ └── Tkinter │ │ └── Introduction-to-tkinter.jsx ├── index.css ├── layouts │ ├── RootLayout.jsx │ └── sidebar │ │ ├── SubMenu.jsx │ │ └── index.jsx └── main.jsx ├── tailwind.config.cjs ├── vite.config.js └── yarn.lock /.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | npm-debug.log* 5 | yarn-debug.log* 6 | yarn-error.log* 7 | 8 | 9 | # Compiled binary addons (http://nodejs.org/api/addons.html) 10 | build/Release 11 | 12 | # Dependency directories 13 | /node_modules/ 14 | jspm_packages/ 15 | 16 | # Distribution directories 17 | dist/ 18 | 19 | # Typescript v1 declaration files 20 | typings/ 21 | 22 | # Optional npm cache directory 23 | .npm 24 | 25 | # Optional eslint cache 26 | .eslintcache 27 | 28 | # Optional REPL history 29 | .node_repl_history 30 | 31 | # Output of 'npm pack' 32 | *.tgz 33 | 34 | # Yarn Integrity file 35 | .yarn-integrity -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing Guidelines 2 | 3 | Welcome to our open-source project! By contributing, you help us create better software for everyone. 4 | 5 | Before you start contributing, please take a moment to read the following guidelines to ensure a smooth and effective contribution process: 6 | 7 |
9 |
10 |
11 |
12 |
14 |
15 |
16 |
17 |
11 | Your Python Library Encyclopedia 🐍📚 12 |
13 |Explore all python libraries
28 |Flask is a micro web framework written in Python, that allows developers to build lightweight web applications quickly and easily with Flask Libraries.It is based on WSGI toolkit and jinja2 template engine.
9 |The backend server Flask was created fully in Python. It is a lightweight application that speeds up the development of backend apps.
It is an acronym for web server gateway interface which is a standard for python web application development. It is considered as the specification for the universal interface between the web server and web application.Werkzeug It is a WSGI toolkit, which implements requests, response objects, and other utility functions. This enables building a web framework on top of it.The Flask framework uses Werkzeug as one of its bases.
Jinja2 is a web template engine which combines a template with a certain data source to render the dynamic web pages.
1. Make sure that Python PIP should be installed on your OS. You can check using the below command.
19 |2. At first, open the command prompt in administrator mode. Then the following command should be run. This command will help to install Flask using Pip in Python and will take very less time to install.
25 |3. After that, also the following two commands should be run. These commands will start Flask in the command prompt. Hence, the process is completed successfully.
29 |Flask doesn't impose a strict structure, but a common structure includes the following files and directories:
37 |To run your web application created app.py using flask, In your terminal, navigate to the directory containing your app.py file and run the Flask application with the following command:
45 |Flask will start a development server, and it will display output indicating that the application is running. Typically, it will say something like "Running on http://127.0.0.1:5000/," indicating that your application is accessible at http://127.0.0.1:5000 in your web browser.
Open a web browser and navigate to the URL displayed in the terminal (e.g., http://127.0.0.1:5000). You should see your Flask application in action.
Write the following lines of code and save to a file named as script.py.
53 |Creating Flask App Object - The Flask class can be imported to create the main application object. It takes the name of the app as an argument.
app = Flask(__name__)
Creating a Route - Routes in a Flask app can be created by defining a view function and associating a URL with it using the route() decorator. Routes specify how the Flask app handles requests it receives, such as what to display on the webpage at a certain URL.
@app.route("/")
Returning HTML From Route - In a Flask app, HTML can be returned from a view function to be rendered on a webpage. The HTML can be returned as a string.
return '<h1>Hello World</h1>'
Running The App in Debugger -This coomand is used to run the flask application with debug mode as on. When debug mode is turned on, It allows developers to locate any possible error and as well the location of the error, by logging a traceback of the error.
if __name__=='__main__':
app.run(debug=True)
The route() decorator in Flask is used to bind URL to a function.
69 |Here, URL ‘/hello’ rule is bound to the hello_world() function. As a result, if a user visits http://localhost:5000/hello URL, the output of the hello_world() function will be rendered in the browser.
A decorator’s purpose is also served by the following representation −
76 |The add_url_rule() function is used to bind a URL with a function as in the above example, route() is used.
82 |The goal is to create a flask application which can render or generate a template when the user goes to a specific URL.
86 |1. First create the templates, you can use any basic HTML template. Before that, create a folder called “templates” in the current folder. Inside this “templates” folder, all of the templates will be residing. For example index.html be:
87 |2. Now, we need a way to actually link the template with a specific route or URL. We need to change the python file script.py
100 |Any parameters beyond the template file name index.html into the templating service can also be used in small snippets of code inside HTML file, such as conditionals or loops.
So, let us re-use our “index.html” and create a block in there. T do that we use “{% block <name> %} (where name = ‘body’) to start the block, this will take everything above it and store it in a virtual block of template, to end the block you simply use “{% endblock %}” this will copy everything below it.
So, here we are not including the <p> tags as everything below the {% endblock %} and everything above the {% block body %} tag is copied. We are also using absolute URLs. The URLs are dynamic and quite easy to understand. We enclose them in “{ }” as part of the Jinja2 syntax. The url_for function reverses the entire URL for us, we just have to pass the name of the function as a string as a parameter to the function.
Now, we’ll create another template to reuse this created block “body”, let’s create the template home.html with the following contents:
This looks like a two-liner but will also extend (not include) the index.html. This is by using the {% extends <file.html> %} tags, they parse the block into the mentioned template. After this, we can add the things we want. If you use the include tag it will not put the replacement paragraph in the correct place on the index.html page. It will create an invalid HTML file, but since the browser is very forgiving you will not notice unless you look at the source generated. The body text must be properly nested.
Inducing Logic in Templates - We can use for loops if conditions in templates. this is such a great feature to leverage on. We can create some great dynamic templates without much of a hassle.
140 |HTTP is the hypertext transfer protocol which is considered as the foundation of the data transfer in the world wide web. All web frameworks including flask need to provide several HTTP methods for data communication. Flask can run different code from the same URL dependent on HTTP method used.
POST Method - It is used to send the form data to the server. The server does not cache the data transmitted using the post method.
144 |Let us first create a form to get some data at the client side from the user, and we will try to access this data on the server by using the POST request.
Start the development server by running the post_example.py. After providing the required input and submitting, the form data is ent to the development server by using the post method.
GET Method - It is the method which can be used to send data in the unencrypted form to the server. By default, the requests are handled by the GET() method. Let's consider the same example for the Get method. However, there are some changes in the data retrieval syntax on the server side. First, create a form as login.html.
After providing the input ans submitting ,The data is sent using the get() method is retrieved on the development server.
The data is obtained by using the following line of code.
217 |Development can start for Matplotlib from here
9 |Development can start for NumPy from here
9 |9 | In the world of software development, creating user-friendly graphical interfaces is a critical aspect of building successful applications. PyQt, a set of Python bindings for the Qt application framework, is a powerful and versatile tool that allows developers to design and implement interactive, cross-platform applications with ease. In this blog, we'll provide you with an introduction to PyQt, exploring what it is, its features, and why it's a valuable choice for developers. 10 |
PyQt is a Python library for creating graphical user interfaces (GUI) for desktop applications. To get started with PyQt, follow these steps:
77 | 78 |Ensure you have Python installed on your system. You can download Python from the official website: Python Downloads.
82 |Open your command line or terminal and run the following command to install PyQt5 using pip
:
pip install PyQt5
88 | If you want to use PyQt5 tools, such as Qt Designer (a visual interface builder), you can install them separately:
94 |pip install PyQt5-tools
96 | Open a Python interpreter in your command line or terminal and try to import PyQt5:
102 |import PyQt5
104 | If there are no errors, PyQt5 is installed correctly.
107 |Select your preferred Integrated Development Environment (IDE) or text editor for Python development. Some popular options include PyCharm, Visual Studio Code, and IDLE (included with Python).
111 |Create a simple PyQt application to test your setup. Here's an example that displays a window:
115 |import sys
117 |
118 | from PyQt5.QtWidgets import QApplication, QWidget
119 |
120 |
121 | app = QApplication(sys.argv)
122 |
123 |
124 |
125 | window = QWidget()
126 |
127 |
128 | window.setWindowTitle("Hello, PyQt!")
129 |
130 |
131 | window.show()
132 |
133 |
134 | sys.exit(app.exec_())
135 |
136 | Save this code to a .py file and run it with your Python interpreter. You should see a window with the title "Hello, PyQt!".
140 |Now you're all set to start developing desktop applications with PyQt using Python. Explore the PyQt documentation and tutorials to create more complex GUI applications.
144 | 145 |Development can start for Pandas from here
9 |Development can start for Python from here
9 |Development can start for Python from here
9 |
10 |
11 | {`Python is a high-level, interpreted programming language known for its readability and simplicity. It:
12 | - Supports multiple programming paradigms.
13 | - Has a large standard library.
14 | - Python is free and easy to learn.
15 |
16 | This doc will help you to get all the knowledge you want for getting started with Python.
17 | If you have never programmed anything before and are just getting started, this might be the blog for you.
18 | Python has many use cases in different industries such as
19 |
20 | Web Development:
21 | - Frameworks like Django and Flask make Python a popular choice for building web applications.
22 |
23 | Data Science and Machine Learning:
24 | - Python is extensively used for data analysis, machine learning, and artificial intelligence.
25 | - Libraries such as NumPy, Pandas, Scikit-learn, TensorFlow, and PyTorch are widely employed.
26 |
27 | Finance:
28 | - Python is used in finance for quantitative analysis, risk management, and algorithmic trading.
29 | - Libraries such as Pandas and NumPy are particularly useful in this domain.
30 |
31 | Education:
32 | - Python is widely used in teaching programming due to its simplicity.
33 | - It's often the first language taught in many computer science courses.
34 |
35 | Game Development:
36 | - Python is used in the game development industry, and libraries like Pygame make it
37 | easier to develop 2D games.
38 |
39 | GIS (Geographic Information System):
40 | - Python is used for GIS applications, and libraries like Geopandas and ArcPy are popular
41 | in this field.`}
42 |
43 |
44 |
49 |
50 |
python --version
or python -V
and press Enter to verify the installation.brew install python
and press Enter.python3 --version
or python3 -V
and press Enter to verify the installation.sudo apt update
to update the package list.sudo apt install python3
to install Python.python3 --version
or python3 -V
and press Enter to verify the installation.Now that we know the importance and some use-cases of Python, let's jump into the interesting and exciting part that is writing our first program using Python. Don't worry if you are writing a program for the first time; you'll get to know soon. Now let's start our first program!
118 |
119 |
121 |
122 | {`print("Hello World!")`}
123 |
124 |
125 |
126 | 127 | Explanation: 128 |
129 |print()
function is used to display the text "Hello, World!" on the screen.136 | To run the programs: 137 |
138 |.py
extension (e.g., hello_world.py
or user_greeting.py
). Open a terminal or command prompt, navigate to the directory where you saved the file, and run the program using python filename.py
(replace filename
with the actual name of your file).
144 |145 | Output: Hello World! 146 |
147 |
These programs are basic examples to help you understand the syntax and structure of Python code. As you progress, you can explore more advanced topics, such as data types, control structures, and functions.
149 | 150 | 151 | 152 |In Python, you can take input from the user using the input()
function. Now let's move on and take input from the user. This function reads a line from the user's input and returns it as a string.
160 |
161 | {`user_input = input("Enter something: ")
162 | print("You entered:", user_input)`}
163 |
164 |
165 |
166 | Explanation:
167 |input("Enter something: ")
prompts the user to enter something and waits for them to input a value.user_input
.print("You entered:", user_input)
displays the entered value to the user.You can use the input()
function without any argument, but providing a prompt inside the function call makes the user interaction more meaningful.
Keep in mind that the input()
function always returns a string. If you want to use the input as a number, you'll need to convert it using functions like int()
or float()
for example:
183 | 184 |
178 |179 | {`user_input = int(input("Enter an integer: ")) 180 | print("You entered:", user_input)`} 181 |
182 |
This code takes an integer as input and converts it to an integer type using int()
function.
Always be cautious when using user input in your programs, especially if you're expecting a specific type of input. You may want to add error handling to handle cases where the user enters unexpected input.
187 | 188 |Keywords in Python are reserved words that have special meanings and cannot be used as identifiers (variable names, function names, etc.). These keywords are part of the Python language syntax and serve specific purposes in the code.
193 |
197 |
198 |
199 | {`flag = True
200 | if flag:
201 | print("The flag is True")`}
202 |
203 |
204 |
205 |
206 | In this example, True
is a Boolean value, and the if
statement checks if the condition is True
and prints a message.
207 | The same goes as for false.
214 |
215 |
216 | {`x = 5
217 | y = 10
218 | if x > 0 and y > 0:
219 | print("Both x and y are greater than 0")`}
220 |
221 |
222 |
223 |
224 | The and
operator is used to combine two conditions. The statement prints a message if both conditions are True
.
228 |
229 |
230 | {`x = 5
231 | y = 10
232 | if x > 0 or y > 0:
233 | print("Either x or y is greater than 0")`}
234 |
235 |
236 |
237 | The or
operator is used when either of a condition is true. The statement prints if one statement is True
out of both.
241 |
242 |
243 | {`x = 5
244 | y = 10
245 | if not (x > 0 and y > 0):
246 | print("Either x or y is not greater than 0")`}
247 |
248 |
249 |
250 | The not
operator is used to negate the condition inside the if
statement. The print
statement will be executed if either x or y (or both) is not greater than 0.
254 |
255 |
256 | {`score = 85
257 | if score >= 90:
258 | print("A grade")
259 | elif score >= 80:
260 | print("B grade")
261 | else:
262 | print("C grade")`}
263 |
264 |
265 |
266 |
267 | If the score is 90 or above, it prints "A grade."
268 | Otherwise, if the score is between 80 and 89 (inclusive), it prints "B grade."
269 | If neither of the above conditions is met, it prints "C grade" as the default grade for scores below 80.
270 | This program uses conditional statements (if, elif, and else) to determine the appropriate grade based on the student's score.
278 | 279 |299 |280 | {`print("Example with break:") 281 | for i in range(5): 282 | if i == 3: 283 | print("Breaking the loop at i =", i) 284 | break 285 | print(i) 286 | `} 287 |
288 |
289 |290 |
297 | 298 |Output for break :
291 | 0
292 | 1
293 | 2
294 | Breaking the loop at i = 3
295 |
296 |
break statement is used to terminate the loop when i becomes equal to 3. As a result, the loop is interrupted, and the message is printed.
300 |304 | 305 |327 |306 | {`print("\nExample with continue:") 307 | for i in range(5): 308 | if i == 2: 309 | print("Skipping iteration at i =", i) 310 | continue 311 | print(i) 312 | `} 313 | 314 |
315 |
316 |317 |
325 | 326 |Output for continue :
318 | 0
319 | 1
320 | Skipping iteration at i = 2
321 | 3
322 | 4
323 |
324 |
continue statement is used to skip the iteration when i is equal to 2. As a result, the print statement inside the loop is bypassed for that specific iteration, and the loop continues with the next iteration.
328 |332 |343 |333 | 334 | # Here '#' is used to add comments for a line, this will not be exceuted / not seen in Output
338 | 339 |
335 | print("Hey there!")
336 | 337 |
340 | Output : Hey there! 341 | 342 |
347 |
348 |
349 | {`def add(x, y):
350 | return x + y
351 |
352 | result = add(3, 5)
353 | print(result)`}
354 |
355 | Output : 8
356 |
357 |
358 |
359 |
360 | Functions are defined using def
, and return
is used to send a value back to the caller. In this case, a simple add
function is defined and called with arguments.
365 |
366 |
367 | {`import math
368 | from math import sqrt as square_root
369 |
370 | result = square_root(25)`}
371 |
372 | Output : 5
373 |
374 |
375 |
376 |
377 | import
is used to bring in a module, and from
allows you to import specific items. In this example, the sqrt
function from the math
module is imported and given the alias square_root
.
383 |384 | # Syntax Error Example
388 |
385 | print("Hello, World!" 386 | 387 |These occur when the code violates the syntax rules of the programming language.
389 |
The interpreter cannot execute the code if it contains syntax errors.
392 |401 |393 | 394 | # Runtime Error Example (Division by Zero)
399 |
395 | x = 10 / 0 396 | 397 | 398 |Also known as exceptions, these errors occur during the execution of the program.
400 |
Common examples include division by zero, accessing an undefined variable,
or trying to open a file that does not exist.
Exception is an event or object that occurs during the execution of a program and disrupts the normal flow of instructions.
Exceptions are typically caused by errors in the code or by unexpected conditions that may arise during runtime.
406 | When an exception occurs, the normal flow of the program is halted, and the control is transferred to a special code segment known as an exception handler.
407 |
408 |
409 |
412 |426 |413 |
423 |try, except block:
414 | 415 | 416 | # Code that may cause an exception
417 | result = 10 / 0
418 | except ZeroDivisionError:
419 | # Code to handle the ZeroDivisionError
420 | print("Cannot divide by zero.")
421 | 422 |
424 |To handle exceptions, the try block is used to enclose the code that might raise an exception,
425 |
and the except block is used to define the actions to be taken if a particular exception occurs.
430 | try: 431 | file = open("example.txt", "r")437 |
432 | # Code to read from the file
433 | finally:
434 | file.close()
435 | 436 |
The "finally" block is used to define cleanup actions that must be executed under all circumstances, whether an exception occurred or not.
439 | 440 | 441 |
445 |
446 |
447 | {`class Dog:
448 | def __init__(self, name, age):
449 | self.name = name
450 | self.age = age
451 |
452 | def bark(self):
453 | print("Woof!")
454 |
455 | # Creating an Object
456 | my_dog = Dog("Buddy", 3)
457 |
458 | # Accessing Class Members
459 | print("Name:", my_dog.name)
460 | print("Age:", my_dog.age)
461 |
462 | # Calling a Method
463 | my_dog.bark()`}
464 |
465 |
466 |
467 |
468 | Classes in Python are used for object-oriented programming. In this example, a Dog
class is defined with a constructor (__init__
) and a method (bark
). An object my_dog
is created, and its attributes and methods are accessed.
469 | The "Dog" class is a simple representation of a dog with attributes for name and age, and a method to make the dog bark. The object "my_dog" is created from this class, and its attributes are accessed and a method is called to demonstrate the basic principles of object-oriented programming in Python.
470 |
9 | Seaborn is a python package that is crucial for information visualization. It is used to make sense of large amounts of data in a straightforward way. 10 |
11 |15 | Graphical display of information and data is known as data visualization. 16 | They offer an easy approach to observe and analyze trends, outliers, patterns in information using visual elements such as charts, graphs, mapping. 17 | If the dataset is large, it becomes a hassle to work with. hence to analyze and generate sound judgment, data visualization is used. 18 |
19 |1. Ensure that you have either Python PIP or Conda installed. You can verify your environment using the following commands.
45 |For PIP users:
46 |For Conda users:
52 |2. Open command prompt as administrator. Then run the following commands to begin installation.
59 |For PIP users:
60 |For Conda users:
64 |3. Finally confirm the installation using these commands into your Python IDE.
69 |79 | In this section, we will implement seaborn on a dataset and plot 3 different types of graphs while also exploring customization options available. 80 |
81 |Now that all the necessary dependencies are imported, we can get started with plotting data. 89 | Seaborn comes with 17 datasets which is useful for beginners to work on. 90 | To see the full list of datasets available, use the command: 91 |
92 |96 | The "tips" dataset is a simple and small dataset that contains information about restaurant tips. It includes the following columns: 97 |
We will use the following commands to display the first 5 rows of the dataset.
108 |114 | A scatter plot is a type of graphical representation used in statistics and data analysis to display the relationship between two variables. 115 | It is especially useful for visualizing the distribution and patterns of data points in a two-dimensional space. 116 |
117 |Let us explore the parameters: 121 |
135 | The executed code should display a plot similar to Fig 1. We can infer how the tips from customers change depending on the total bill. 136 | Additionally, the tips are sorted according to four different colours for each day while the size of the circle indicates the number of people in that customer group. 137 |
138 |140 | A histogram is a graphical representation of the distribution of a dataset, showing the frequency or count of data points within specific intervals also known as 'bins'. 141 |
142 |146 | Let us explore the parameters: 147 |
159 | The executed code should display a plot similar to Fig 2. We can infer how the frequenctly a particular amount is received by a waiter. 160 |
161 |163 | A barplot is a way to create a bar chart to visualize the relationship between a categorical variable and a numeric variable. For example, we can use this plot to compare the number of males vs the number of females who give tips. 164 |
165 |Let us explore the parameters: 169 |
180 | The executed code should display a plot similar to Fig 3. According to the graph, male customers give larger tips than their female counterparts. 181 | The mean of male customer tips is slightly greater than 3 compared to female customers which is around 2.8. 182 |
183 |9 | TensorFlow is a popular open-source machine learning framework developed by Google. It has gained widespread adoption in the machine learning and deep learning communities. 10 |
37 | Machine learning is a subfield of artificial intelligence (AI) that focuses on creating algorithms that can learn from and make predictions or decisions based on data. These algorithms can improve their performance over time with more data and experience. 38 |
39 |41 | ensors are like multi-dimensional arrays, and they can have various ranks. For instance, a scalar (single number) is a rank-0 tensor, a vector (e.g., an array of numbers) is a rank-1 tensor, and a matrix is a rank-2 tensor. Tensors are at the core of TensorFlow, and most data in machine learning is represented as tensors. 42 |
45 | TensorFlow is like a super versatile tool that can teach computers and make them smart. It can work on regular computers (CPUs), super-fast graphics cards (GPUs), and even special machines called TPUs, which are like rocket boosters for learning. This means you can use TensorFlow for both small and big projects, and it will be quick and efficient. 46 |
47 |50 | In TensorFlow, computations are represented as a directed graph. This graph is made up of nodes (also called operations or ops) and edges. Nodes are operations that perform computations on tensors. For example, you might have nodes for addition, multiplication, or matrix operations. 51 |
54 | To execute operations in a TensorFlow graph, you need to create a session. The session allocates resources and performs the computations. This is where the "magic" happens, as it evaluates the operations in the graph and produces results. 55 |
58 | In machine learning, you often need to work with parameters that change during training (like the weights of a neural network). TensorFlow provides the concept of variables to represent these changing parameters. Placeholders, on the other hand, are used to feed data into the model. 59 |
62 | Neural networks are a class of machine learning models inspired by the structure of the human brain. They consist of layers of interconnected nodes (neurons) that process and transform data to make predictions or decisions. 63 |
66 | Deep learning is a subfield of machine learning that focuses on using deep neural networks, typically with multiple hidden layers. TensorFlow is particularly well-suited for building and training deep neural networks. 67 |
70 | Training a model in TensorFlow involves feeding it a dataset, making predictions, calculating how wrong those predictions are, and then adjusting the model's parameters to make better predictions. This process is typically done through backpropagation and optimization algorithms. 71 |
74 | TensorFlow provides high-level APIs (like Keras) that make it easier to build and train machine learning models. These APIs abstract away many of the complexities, making it more accessible for beginners. 75 |
78 | TensorFlow has a large and active community with plenty of tutorials, documentation, and resources to help you learn and solve problems. 79 |
82 | TensorFlow is used in a wide range of applications, including image and speech recognition, natural language processing, recommendation systems, and more. It's not limited to any specific domain and can be applied to various real-world problems. 83 |
84 |
90 |
91 |
python --version
or python -V
and press Enter to verify the installation.155 | In TensorFlow, a tensor is a fundamental data structure that represents multi-dimensional arrays. Tensors are the primary building blocks for constructing and manipulating machine learning models. They can be thought of as generalizations of matrices and can have various dimensions, including scalars, vectors, matrices, and higher-dimensional arrays. 156 |
157 |160 | Tensors of rank 0 are scalars. They have no dimensions and represent single values. In TensorFlow, you can create a scalar tensor like this: 161 |
169 | Tensors of rank 1 are vectors. They have one dimension and can be considered as an array of values. 170 |
177 | Tensors of rank 2 are matrices. They have two dimensions, representing rows and columns. For example: 178 |
185 | Tensors can have more than two dimensions. For instance, a rank-3 tensor could represent a cube of values, and a rank-4 tensor could represent a hyperspace. 186 |
194 | Tensors can hold data of different types, such as tf.float32, tf.int32, and more. You can specify the data type when creating a tensor. 195 |
203 | TensorFlow provides a wide range of operations to manipulate tensors, including element-wise operations, matrix operations, and more complex operations for building and training machine learning models. 204 |
213 | The shape of a tensor describes its dimensions. You can access the shape of a tensor using the .shape attribute. 214 |
221 | You can change the shape of a tensor using the tf.reshape function. This is useful when you need to convert a tensor from one shape to another. 222 |
229 | You can create tensors using tf.constant for constant values, and tf.Variable for mutable tensors that can be updated during training. 230 |
240 | TensorFlow variables are a fundamental part of deep learning and machine learning models. They serve as containers for storing and managing the model's learnable parameters, which are iteratively updated during training to minimize the loss function and improve the model's performance. TensorFlow's efficient memory management, automatic differentiation, and device placement capabilities make it a powerful framework for handling variables and optimizing model training. 241 |
Import TensorFlow: To use TensorFlow, you need to import it at the beginning of your Python script or notebook. 245 |
246 |253 | To create a TensorFlow variable, you can use the tf.Variable() constructor. You typically initialize variables with initial values 254 |
255 |262 | Variables need to be explicitly initialized using tf.global_variables_initializer() before they can be used in a TensorFlow session. However, in modern versions of TensorFlow (2.x and later), you can often skip this step, as variable initialization is handled automatically. 263 |
264 |267 | Variables are typically updated during training to optimize a model's parameters. You can use operations like assign() and assign_add() to change the value of a variable. 268 |
269 |275 | TensorFlow allows you to group variables into collections. This can be helpful when saving or loading models. You can add variables to collections using `tf.add_to_collection()`. 276 |
277 |283 | You can save and restore variables using TensorFlow's `tf.train.Saver`. This is useful for checkpointing your model's progress during training and for deploying trained models. 284 |
285 |294 | You can specify where you want to place a variable, either on a CPU or a GPU. This can be done using the `device` argument when creating the variable. 295 |
296 |303 | You can use variable scopes to organize variables and manage their names. This can help with debugging and readability. 304 |
305 |312 | In TensorFlow 2.x, eager execution is enabled by default, which means you can manipulate variables just like any other Python objects without the need for a session. Eager execution makes TensorFlow code more intuitive and Pythonic. 313 |
314 |320 | TensorFlow Variables are tracked as resource objects and have built-in memory management and device placement. 321 |
322 |9 | Tkinter ("Tk Interface")is python's standard cross-platform package 10 | for creating graphical user interfaces (GUIs). Tkinter's greatest 11 | strength is its ubiquity and simplicity. It works out of the box on 12 | most platforms (linux, OSX, Windows). 13 |
14 |16 | Tkinter is lightweight and relatively painless to use compared to 17 | other frameworks. This makes it a compelling choice for building GUI 18 | applications in Python, especially for applications where a modern 19 | sheen is unnecessary, and the top priority is to quickly build 20 | something that’s functional and cross-platform. 21 |
22 |29 | Developing desktop based applications with python Tkinter is not a 30 | complex task. An empty Tkinter top-level window can be created by 31 | using the following steps. 32 |
33 |55 | We will learn about some more widgets like buttons, frames, etc. 56 | in the next section.. 57 |
Widget is an element of Graphical User Interface (GUI) that displays/illustrates information or gives a way for the user to interact with the OS. In Tkinter , Widgets are objects ; instances of classes that represent buttons, frames, and so on. Each separate widget is a Python object. When creating a widget, you must pass its parent as a parameter to the widget creation function. The only exception is the “root” window, which is the top-level window that will contain everything else and it does not have a parent.
Widget | 77 |Description | 78 |
---|---|
Label | 82 |A Widget used to display text on the screen. | 83 |
Button | 87 |88 | {" "} 89 | A button that can contain text and can perform an action when 90 | clicked. 91 | | 92 |
Entry | 96 |97 | A text entry widget that allows only a single line of text 98 | | 99 |
Frame | 103 |104 | A rectangular region used to group related widgets or provide 105 | padding between widgets 106 | | 107 |
Checkbutton | 111 |112 | The Checkbutton is used to display the CheckButton on the 113 | window. 114 | | 115 |
Radiobutton | 119 |120 | The Radiobutton is different from a checkbutton. Here, the user 121 | is provided with various options and the user can select only 122 | one option among them. 123 | | 124 |
Scrollbar | 128 |129 | It provides the scrollbar to the user so that the user can 130 | scroll the window up and down. 131 | | 132 |
MessageBox | 136 |137 | This module is used to display the message-box in the desktop 138 | based applications. 139 | | 140 |
ListBox | 144 |145 | The ListBox widget is used to display a list of options to the 146 | user. 147 | | 148 |
158 | The Tkinter geometry specifies the method by using which, the widgets 159 | are represented on display. The python Tkinter provides the following 160 | geometry methods. 161 |
162 |169 | The pack() widget is used to organize widget in the block. The 170 | positions widgets added to the python application using the pack() 171 | method can be controlled by using the various options specified in the 172 | method call. 173 |
174 |179 | A list of possible options that can be passed in pack() is given 180 | below. 181 |
182 |200 | The grid() geometry manager organizes the widgets in the tabular form. 201 | We can specify the rows and columns as the options in the method call. 202 | We can also specify the column span (width) or rowspan(height) of a 203 | widget. 204 |
205 |210 | A list of possible options that can be passed inside the grid() method 211 | is given below. 212 |
213 |The place() geometry manager organizes the widgets to the specific x and y coordinates. 256 |
257 |A list of possible options is given below.
261 |{data.title}
17 |PyLibLog
137 | From The Curious Community 138 |140 | Upgrade 141 |
*/} 142 |