Why Python list comprehensions are faster and more elegant
Hello! Since my last disassemble-ing video was so well received, I made another one!
In this video we disassemble list comprehensions and find out why they are faster than their for loop cousins: [https://www.youtube.com/watch?v=kp0QWQbSv30](https://www.youtube.com/watch?v=kp0QWQbSv30)
If you are not familiar with Python bytecode, feel free to check this other video out before which explains it: [https://www.youtube.com/watch?v=HY7cMB0Rx8w](https://www.youtube.com/watch?v=HY7cMB0Rx8w)
I would love to see a discussion on if you've ever heard of python bytecode, and if you have, how you have used it to improve your understanding of the Python interpreter!
/r/Python
https://redd.it/inmda0
Hello! Since my last disassemble-ing video was so well received, I made another one!
In this video we disassemble list comprehensions and find out why they are faster than their for loop cousins: [https://www.youtube.com/watch?v=kp0QWQbSv30](https://www.youtube.com/watch?v=kp0QWQbSv30)
If you are not familiar with Python bytecode, feel free to check this other video out before which explains it: [https://www.youtube.com/watch?v=HY7cMB0Rx8w](https://www.youtube.com/watch?v=HY7cMB0Rx8w)
I would love to see a discussion on if you've ever heard of python bytecode, and if you have, how you have used it to improve your understanding of the Python interpreter!
/r/Python
https://redd.it/inmda0
YouTube
Why Python list comprehensions are faster and more elegant
Hello!
In this video we disassemble list comprehensions and find out why they are faster than their for loop cousins.
Hope you enjoy!
In this video we disassemble list comprehensions and find out why they are faster than their for loop cousins.
Hope you enjoy!
Monday megathread: Project ideas!
Comment any project ideas beginner or advanced in this thread for others to give a try! If you complete one make sure to reply to the comment with how you found it and attach some source code!
/r/Python
https://redd.it/inwyn1
Comment any project ideas beginner or advanced in this thread for others to give a try! If you complete one make sure to reply to the comment with how you found it and attach some source code!
/r/Python
https://redd.it/inwyn1
reddit
Monday megathread: Project ideas!
Comment any project ideas beginner or advanced in this thread for others to give a try! If you complete one make sure to reply to the comment with...
My Django app passes authentication on localhost, but not on heroku
So I created a simple "social media website" where by using API I GET data from a database and I can also POST to create a social media post after I register and log in. On my localhost it all works well. I can register, login, then write a social media post and it displays on the screen. However, when I use Heroku, GET API works fine, but after I log in (and I am sure I am logged in as I can log in on admin), I cannot write anything on my website. In my IDE I get: Forbidden: /api/posts/action/
In the network page I can see this:
Request URL: http://localhost:8000/api/posts/action/ Request Method: POST Status Code: 403 Forbidden Remote Address: 127.0.0.1:8000 Referrer Policy: no-referrer-when-downgrade
Any idea where should I look for an error? If there is any code I should send, let me know. Thank you!
/r/django
https://redd.it/io0jc7
So I created a simple "social media website" where by using API I GET data from a database and I can also POST to create a social media post after I register and log in. On my localhost it all works well. I can register, login, then write a social media post and it displays on the screen. However, when I use Heroku, GET API works fine, but after I log in (and I am sure I am logged in as I can log in on admin), I cannot write anything on my website. In my IDE I get: Forbidden: /api/posts/action/
In the network page I can see this:
Request URL: http://localhost:8000/api/posts/action/ Request Method: POST Status Code: 403 Forbidden Remote Address: 127.0.0.1:8000 Referrer Policy: no-referrer-when-downgrade
Any idea where should I look for an error? If there is any code I should send, let me know. Thank you!
/r/django
https://redd.it/io0jc7
reddit
My Django app passes authentication on localhost, but not on heroku
So I created a simple "social media website" where by using API I GET data from a database and I can also POST to create a social media post after...
Tesla V100 GPUs are now available in Colab! [Discussion]
​
https://preview.redd.it/gs55dli7ynl51.png?width=712&format=png&auto=webp&s=2cf12b68096df12d08ac4d71a55acb4872f8b921
/r/MachineLearning
https://redd.it/io201w
​
https://preview.redd.it/gs55dli7ynl51.png?width=712&format=png&auto=webp&s=2cf12b68096df12d08ac4d71a55acb4872f8b921
/r/MachineLearning
https://redd.it/io201w
I created a coronavirus dashboard using Dash from Plotly making predictions for all countries and US states
I created a [coronavirus dashboard showing all COVID-19 deaths/cases][1] for all countries and US states along with predictions for all those areas.
I also created a [page to view model performance][2] for all areas at any historical date.
The model is built by first using repeated moving average smoothing and then a combination of exponential and logistic growth functions with growth rate modeled as a function of time.
Libraries used:
* pandas to read in and clean the data
* scipy to fit function parameters
* plotly to make visualizations
* dash to build web application
[1]: https://coronavirus.dunderdata.com
[2]: https://coronavirus.dunderdata.com/model_performance
/r/Python
https://redd.it/io9650
I created a [coronavirus dashboard showing all COVID-19 deaths/cases][1] for all countries and US states along with predictions for all those areas.
I also created a [page to view model performance][2] for all areas at any historical date.
The model is built by first using repeated moving average smoothing and then a combination of exponential and logistic growth functions with growth rate modeled as a function of time.
Libraries used:
* pandas to read in and clean the data
* scipy to fit function parameters
* plotly to make visualizations
* dash to build web application
[1]: https://coronavirus.dunderdata.com
[2]: https://coronavirus.dunderdata.com/model_performance
/r/Python
https://redd.it/io9650
Dunderdata
Coronavirus Prediction Dashboard
Global Coronavirus Dashboard with Predictions by Ted Petrou
[D] PSA: NVIDIA's Tensor-TFLOPS values for their newest GPUs include sparsity
NVIDIA claims the 3080 has 238 ‘Tensor-TFLOPS’ of performance from their tensor cores, the 3090 has 285, and the 3070 has 163. As usual, these numbers are for 16-bit floating point. In contrast, the 2080 Ti has only 114 TFLOPS of ‘Tensor-TFLOPS’, so you would be forgiven for thinking the 30 series will be much faster at training.
Alas, the values for the 30 series are *TFLOPS-equivalent with sparsity*, not actual TFLOPS. Ampere has support for ‘2:4 structured sparsity’, which accelerates matrix multiplications where half of the values in every block of four are zeroed. This means that the actual number of TFLOPS for the 3080, 3090 and 3070 are 119, 143, and 81.
When Ampere originally launched on the A100, NVIDIA was [very clear](https://www.nvidia.com/en-gb/data-center/a100/#specifications) about differentiating real TFLOPS from TFLOPS-equivalent with sparsity. It is incredibly disappointing that NVIDIA have been not at all upfront about this with their new GeForce GPUs. This is made worse by the fact that the tensor cores have been cut in half in the GeForce line relative to the A100, so it is easy to get confused into thinking the doubled numbers are correct.
Although hardware sparsity support is a great feature, it obviously only provides benefits
/r/MachineLearning
https://redd.it/ioa9za
NVIDIA claims the 3080 has 238 ‘Tensor-TFLOPS’ of performance from their tensor cores, the 3090 has 285, and the 3070 has 163. As usual, these numbers are for 16-bit floating point. In contrast, the 2080 Ti has only 114 TFLOPS of ‘Tensor-TFLOPS’, so you would be forgiven for thinking the 30 series will be much faster at training.
Alas, the values for the 30 series are *TFLOPS-equivalent with sparsity*, not actual TFLOPS. Ampere has support for ‘2:4 structured sparsity’, which accelerates matrix multiplications where half of the values in every block of four are zeroed. This means that the actual number of TFLOPS for the 3080, 3090 and 3070 are 119, 143, and 81.
When Ampere originally launched on the A100, NVIDIA was [very clear](https://www.nvidia.com/en-gb/data-center/a100/#specifications) about differentiating real TFLOPS from TFLOPS-equivalent with sparsity. It is incredibly disappointing that NVIDIA have been not at all upfront about this with their new GeForce GPUs. This is made worse by the fact that the tensor cores have been cut in half in the GeForce line relative to the A100, so it is easy to get confused into thinking the doubled numbers are correct.
Although hardware sparsity support is a great feature, it obviously only provides benefits
/r/MachineLearning
https://redd.it/ioa9za
NVIDIA
A100 GPU's Offer Power, Performance, & Efficient Scalability
Most powerful end-to-end AI and HPC platform for data centers that solves scientific, industrial, and big data challenges.
Python Tips and Best Practices for Building Robust Data Science Workflows
https://medium.com/swlh/software-engineering-tips-and-best-practices-for-data-science-5d85dbcf87fd
/r/Python
https://redd.it/io4rx5
https://medium.com/swlh/software-engineering-tips-and-best-practices-for-data-science-5d85dbcf87fd
/r/Python
https://redd.it/io4rx5
Medium
Software Engineering Tips and Best Practices for Data Science
With great code comes great machine learning
[D] Which GPU(s) to get for Deep Learning (Updated for RTX 3000 Series)
Tim Dettmers just updated his legendary blogpost to include advice for the RTX 3000 series
Blog: [https://timdettmers.com/2020/09/07/which-gpu-for-deep-learning/](https://timdettmers.com/2020/09/07/which-gpu-for-deep-learning/)
PS: I had a chance to interview him earlier last year, this interview also has some very general PC Building advice: [https://www.youtube.com/watch?v=8Fp9m4fNDQ4](https://www.youtube.com/watch?v=8Fp9m4fNDQ4)
/r/MachineLearning
https://redd.it/ioascy
Tim Dettmers just updated his legendary blogpost to include advice for the RTX 3000 series
Blog: [https://timdettmers.com/2020/09/07/which-gpu-for-deep-learning/](https://timdettmers.com/2020/09/07/which-gpu-for-deep-learning/)
PS: I had a chance to interview him earlier last year, this interview also has some very general PC Building advice: [https://www.youtube.com/watch?v=8Fp9m4fNDQ4](https://www.youtube.com/watch?v=8Fp9m4fNDQ4)
/r/MachineLearning
https://redd.it/ioascy
Tim Dettmers
The Best GPUs for Deep Learning in 2023 — An In-depth Analysis
Here, I provide an in-depth analysis of GPUs for deep learning/machine learning and explain what is the best GPU for your use-case and budget.
Tuesday megathread: Advanced questions
Have some burning questions on advanced Python topics? Use this thread to ask more advanced questions related to Python.
**If your question is a beginner question we hold a beginner megathread tomorrow (Wednesday) where you can ask any question! We may remove questions here and ask you to resubmit tomorrow.**
/r/Python
https://redd.it/ioj3st
Have some burning questions on advanced Python topics? Use this thread to ask more advanced questions related to Python.
**If your question is a beginner question we hold a beginner megathread tomorrow (Wednesday) where you can ask any question! We may remove questions here and ask you to resubmit tomorrow.**
/r/Python
https://redd.it/ioj3st
reddit
Tuesday megathread: Advanced questions
Have some burning questions on advanced Python topics? Use this thread to ask more advanced questions related to Python. **If your question is a...
Beginner looking for advice on Flask + machine learning
I want to do a personal project, creating a Flask website that uses Nvidia's StyleGAN2 to generate some faces. I'm learning Flask because I'm familiar with deploying machine learning models in Python, so I figured a flexible Python microframework would be best.
The problem I'm facing is that StyleGAN2 requires GPU to run, and I'm using a Macbook without a discrete GPU (it uses Intel Iris Plus Graphics 640 1536 MB). I'm very comfortable with machine learning in Python using Google Collab, which provides GPU services, but I don't know how to host a website and access GPU to run ML models. Would AWS/Azure work well, and if so, which would allow me to easily leverage GPU in the cloud to host a website? Do I need to learn/use Docker?
I'm not super familiar with web development, so any input whatsoever would be appreciated :)
/r/flask
https://redd.it/ioihkn
I want to do a personal project, creating a Flask website that uses Nvidia's StyleGAN2 to generate some faces. I'm learning Flask because I'm familiar with deploying machine learning models in Python, so I figured a flexible Python microframework would be best.
The problem I'm facing is that StyleGAN2 requires GPU to run, and I'm using a Macbook without a discrete GPU (it uses Intel Iris Plus Graphics 640 1536 MB). I'm very comfortable with machine learning in Python using Google Collab, which provides GPU services, but I don't know how to host a website and access GPU to run ML models. Would AWS/Azure work well, and if so, which would allow me to easily leverage GPU in the cloud to host a website? Do I need to learn/use Docker?
I'm not super familiar with web development, so any input whatsoever would be appreciated :)
/r/flask
https://redd.it/ioihkn
reddit
Beginner looking for advice on Flask + machine learning
I want to do a personal project, creating a Flask website that uses Nvidia's StyleGAN2 to generate some faces. I'm learning Flask because I'm...
[R] Measuring Massive Multitask Language Understanding; a new test consisting of 14,080 questions given to GPT-3 (4 model sizes), UnifiedQA, and T5
[https://arxiv.org/abs/2009.03300](https://arxiv.org/abs/2009.03300)
Abstract:
>We propose a new test to measure a text model's multitask accuracy. The test covers 57 tasks including elementary mathematics, US history, computer science, law, and more. To attain high accuracy on this test, models must possess extensive world knowledge and problem solving ability. We find that while most recent models have near random-chance accuracy, the very largest GPT-3 model improves over random chance by almost 20 percentage points on average. However, on every one of the 57 tasks, the best models still need substantial improvements before they can reach human-level accuracy. Models also have lopsided performance and frequently do not know when they are wrong. Worse, they still have near-random accuracy on some socially important subjects such as morality and law. By comprehensively evaluating the breadth and depth of a model's academic and professional understanding, our test can be used to analyze models across many tasks and to identify important shortcomings.
/r/MachineLearning
https://redd.it/iol3l7
[https://arxiv.org/abs/2009.03300](https://arxiv.org/abs/2009.03300)
Abstract:
>We propose a new test to measure a text model's multitask accuracy. The test covers 57 tasks including elementary mathematics, US history, computer science, law, and more. To attain high accuracy on this test, models must possess extensive world knowledge and problem solving ability. We find that while most recent models have near random-chance accuracy, the very largest GPT-3 model improves over random chance by almost 20 percentage points on average. However, on every one of the 57 tasks, the best models still need substantial improvements before they can reach human-level accuracy. Models also have lopsided performance and frequently do not know when they are wrong. Worse, they still have near-random accuracy on some socially important subjects such as morality and law. By comprehensively evaluating the breadth and depth of a model's academic and professional understanding, our test can be used to analyze models across many tasks and to identify important shortcomings.
/r/MachineLearning
https://redd.it/iol3l7
reddit
[R] Measuring Massive Multitask Language Understanding; a new test...
[https://arxiv.org/abs/2009.03300](https://arxiv.org/abs/2009.03300) Abstract: >We propose a new test to measure a text model's multitask...
4001 x 4001 px Maze generated by a python script I wrote, (blue line is solution)
/r/Python
https://redd.it/ioq0d4
/r/Python
https://redd.it/ioq0d4
A star pathfinding algorithm visualized using pygame.
I Made A star algorithm using Euclidean distance and diagonal movement
Watch Video: [https://youtu.be/m8u533opxpM](https://youtu.be/m8u533opxpM)
GitHub Link: [https://github.com/nas-programmer/path-finding/blob/master/astar.py](https://github.com/nas-programmer/path-finding/blob/master/astar.py)
/r/Python
https://redd.it/ioovos
I Made A star algorithm using Euclidean distance and diagonal movement
Watch Video: [https://youtu.be/m8u533opxpM](https://youtu.be/m8u533opxpM)
GitHub Link: [https://github.com/nas-programmer/path-finding/blob/master/astar.py](https://github.com/nas-programmer/path-finding/blob/master/astar.py)
/r/Python
https://redd.it/ioovos
YouTube
A* Path finding Visualization - Python Pygame A Star Path Finding Algorithm Visualized
A star pathfinding algorithm visualized using the Pygame library of python.
Build a pathfinding visualizer tool to visualize the astar pathfinding algorithm as it runs. This astar pathfinding algorithm is an informed search algorithm making it more efficient…
Build a pathfinding visualizer tool to visualize the astar pathfinding algorithm as it runs. This astar pathfinding algorithm is an informed search algorithm making it more efficient…
I’ve made a sub for testing your reddit bots, so you don’t have to annoy moderators
Join r/TestRedditBots, you can also submit tutorials
/r/Python
https://redd.it/iopvl2
Join r/TestRedditBots, you can also submit tutorials
/r/Python
https://redd.it/iopvl2
reddit
I’ve made a sub for testing your reddit bots, so you don’t have to...
Join r/TestRedditBots, you can also submit tutorials
Running a Machine Learning Model in Django.
I am using Django REST Framework to run my ML model, in the views class. My model runs everytime a post request is made. Is there any better place to run the model? Some way to preload the model or do it in the background?
/r/django
https://redd.it/ioqm4k
I am using Django REST Framework to run my ML model, in the views class. My model runs everytime a post request is made. Is there any better place to run the model? Some way to preload the model or do it in the background?
/r/django
https://redd.it/ioqm4k
reddit
Running a Machine Learning Model in Django.
I am using Django REST Framework to run my ML model, in the views class. My model runs everytime a post request is made. Is there any better place...
Custom CSS Style a Jupyter Notebook (self blog)
https://skelouse.github.io/styling_a_jupyter_notebook
/r/IPython
https://redd.it/ioplkz
https://skelouse.github.io/styling_a_jupyter_notebook
/r/IPython
https://redd.it/ioplkz
skelouse.github.io
Styling a Jupyter Notebook - My Dev Canvas
A Humble Abode For My Biased Blogs About Things I Have Learned In Python, Data Science, And Programming in General
What's expected from a Junior/Mid/Senior Django developer?
This is a question I have in mind because I've not been put in an enterprise-grade work before. I've lots of experience tampering around myself in lots of things, I find myself knowing many things in the technologies I use that mid-seniors don't know (but I can't work in a team...etc). I can't judge my skills from my own perspective. I need someone to help me judge what's the perfect level of a job for me to apply to or how to know that. I've been in programming for more than 5 years, but only 1 in Django, I worked 2 years as a freelancer, but my CV is still empty except probably the skills section and some personal projects.
/r/django
https://redd.it/ioua0o
This is a question I have in mind because I've not been put in an enterprise-grade work before. I've lots of experience tampering around myself in lots of things, I find myself knowing many things in the technologies I use that mid-seniors don't know (but I can't work in a team...etc). I can't judge my skills from my own perspective. I need someone to help me judge what's the perfect level of a job for me to apply to or how to know that. I've been in programming for more than 5 years, but only 1 in Django, I worked 2 years as a freelancer, but my CV is still empty except probably the skills section and some personal projects.
/r/django
https://redd.it/ioua0o
reddit
What's expected from a Junior/Mid/Senior Django developer?
This is a question I have in mind because I've not been put in an enterprise-grade work before. I've lots of experience tampering around myself in...
@app.route can't grab by id
I want to grab by **id** but I can't seem to get it right. my code below
@app.route('/post/delete/<int:id>')
def delete(id):
posts = BlogPost.query.get_or_404(id)
db.session.delete(posts)
db.session.commit()
return redirect('/post')
@app.route('/post/edit/<int:id>', methods=['GET' 'POST'])
def edit(id):
if request.method == 'POST':
posts = BlogPost.query.get_or_404(id)
posts.title = request.form['title']
posts.content = request.form['content']
posts.author = request.form['author']
db.session.commit()
return redirect('/post')
else:
return render_template('edit.html')
ninja syntax in
/r/flask
https://redd.it/iozbxv
I want to grab by **id** but I can't seem to get it right. my code below
@app.route('/post/delete/<int:id>')
def delete(id):
posts = BlogPost.query.get_or_404(id)
db.session.delete(posts)
db.session.commit()
return redirect('/post')
@app.route('/post/edit/<int:id>', methods=['GET' 'POST'])
def edit(id):
if request.method == 'POST':
posts = BlogPost.query.get_or_404(id)
posts.title = request.form['title']
posts.content = request.form['content']
posts.author = request.form['author']
db.session.commit()
return redirect('/post')
else:
return render_template('edit.html')
ninja syntax in
/r/flask
https://redd.it/iozbxv
reddit
r/flask - @app.route can't grab by id
2 votes and 12 comments so far on Reddit
Non-Linear SVM Tutorial and Explanation
[https://www.youtube.com/watch?v=NnoGY8ybzrs](https://www.youtube.com/watch?v=NnoGY8ybzrs&t=11s)
/r/pystats
https://redd.it/ip4jfc
[https://www.youtube.com/watch?v=NnoGY8ybzrs](https://www.youtube.com/watch?v=NnoGY8ybzrs&t=11s)
/r/pystats
https://redd.it/ip4jfc
YouTube
Using Non-Linear SVM on Radial Data
In this video, I go over how to use a non-linear SVM for the classification of points.
Part 1 of this series goes over how to create the data: https://www.youtube.com/watch?v=0ljgjjWpivU
Article mentioned in the video: https://medium.com/all-things-ai/in…
Part 1 of this series goes over how to create the data: https://www.youtube.com/watch?v=0ljgjjWpivU
Article mentioned in the video: https://medium.com/all-things-ai/in…