Python Daily
2.57K subscribers
1.48K photos
53 videos
2 files
38.9K links
Daily Python News
Question, Tips and Tricks, Best Practices on Python Programming Language
Find more reddit channels over at @r_channels
Download Telegram
D What is the most complete reference on the history of neural networks?

I'm looking for a comprehensive reference on the history of neural networks that covers all significant papers in the field, from the early days up to the current deep learning era, and provides information on their main contributions and inspirations. It would be helpful to have information on how the understanding and perspectives of the research community on neural networks have evolved over time as well.

Do you know of any good references like that?

/r/MachineLearning
https://redd.it/106ixxx
R Greg Yang's work on a rigorous mathematical theory for neural networks

Greg Yang is a mathematician and AI researcher at Microsoft Research who for the past several years has done incredibly original theoretical work in the understanding of large artificial neural networks. His work currently spans the following five papers:

Tensor Programs I: Wide Feedforward or Recurrent Neural Networks of Any Architecture are Gaussian Processes: https://arxiv.org/abs/1910.12478
Tensor Programs II: Neural Tangent Kernel for Any Architecture: https://arxiv.org/abs/2006.14548
Tensor Programs III: Neural Matrix Laws: https://arxiv.org/abs/2009.10685
Tensor Programs IV: Feature Learning in Infinite-Width Neural Networks: https://proceedings.mlr.press/v139/yang21c.html
Tensor Programs V: Tuning Large Neural Networks via Zero-Shot Hyperparameter Transfer: https://arxiv.org/abs/2203.03466

In our whiteboard conversation, we get a sample of Greg's work, which goes under the name "Tensor Programs". The route chosen to compress Tensor Programs into the scope of a conversational video is to place its main concepts under the umbrella of one larger, central, and time-tested idea: that of taking a large N limit. This occurs most famously in the Law of Large Numbers and the Central Limit Theorem, which then play a fundamental role in the branch of mathematics known as Random Matrix Theory (RMT). We review this foundational material and then show how Tensor Programs (TP) generalizes this classical work,

/r/MachineLearning
https://redd.it/105v7el
P searchthearxiv.com: Semantic search across more than 250,000 ML papers on arXiv

I just launched searchthearxiv.com, a simple semantic search engine over virtually all ML papers published on arXiv since 2012. The site uses OpenAI's `text-embedding-ada-002` model to match the embedding of your query against each of the paper embeddings, retrieving the ones with the highest cosine similarity. It also allows you to insert an arXiv link to find similar papers.

This was mostly meant as a fun side project. However, if people find it useful, I'm happy to maintain it and keep the database up-to-date. I'd love to know what you think! ❤️

/r/MachineLearning
https://redd.it/106hxgk
how can i prevent the display of few views for a particular user ? in Flask-Admin

​

Model Views for User named Admin

​

Model Views for User named Preethi

​

From the image you can see that for both the users (Admin and Preethi) the following ModelViews are visible or displayed : Home, Car, Profile, Username, usertest.
I want to prevent the user named Preethi from being able to see the ModelViews Profile and Username.
I want the user named Preethi to only see the ModelViews: Home,Car,usertest.
how do I implement that. I tried user based access and if statements to create these models based on the roles or username, but the model views are created at the program run and not when the form is submitted or when the post request gets fulfilled. Please help me with this.

/r/flask
https://redd.it/106uayl
Seeking suggestions in order to implement two features to complete my django final year project


1. Live onsite group discussion (kinda live chatroom)
2. Ai based movie recommendation system


So Im about 6 months into Django development.
Currently doing my final year web project. And I was instructed to add these two features on my user based rating recommendation website.


Im totally clueless and paranoid right now.
I just need to know. From where should I start? Any resources that you guys can suggest? I just need to know the correct approach & things I need to learn.

Thank you so much.

/r/django
https://redd.it/106jwca
Hhow much of the source code could I reuse?

Hello!

I am new to Django, I have made a desktop system programmed with Python 3 + PostgreSQL + wxPython, I am thinking of creating its web version, I would like to know how much of the source code could I reuse? taking into account that the business logic, data layer and the GUI are logically separated.

Mario

/r/django
https://redd.it/106ru2n
What are some free website to host aagi django application ?

I want to use websockets. Pythonanywhere doesn't work. Heroku is now paid.

/r/django
https://redd.it/106pvt6
Contact users via email

How do you send emails to your users with Django, be it account activation, information about upcoming maintenance work, news?

/r/django
https://redd.it/106gwis
edit multiple rows

i have a template in django which displays lets say some info abut a book in a tabular form.lets say there are 3 books,can i edit these book's info by clicking an edit button.remember this is to edit multiple values simultaneously much like a bulk edit.

/r/django
https://redd.it/106lukv
(Taggit Library) - Adding a foreign key to taggittag model. Should I create a new table, or extend Tag?

Hey!

Right now taggit\
tag comes with two fields: name and slug. This means all tags added to my application are global and can't be separated by the account that's using it. Therefore I'd like to add a foreign key to the model;account = models.ForeignKey("Account", on_delete=models.CASCADE)

​

Can anyone suggest ways of doing this? I think I need to make my own model that extends taggit-tag, with the same name and add the extra field. I can then also extend the save() method to ensure an account_id is being added (which I can derive from the object I'm tagging) .

Something like this:

from django.db import models
from taggit.models import Tag


class Tag(Tag):
account = models.ForeignKey("Account", on_delete=models.CASCADE)
super()


​

But I could be waaaay off. Can anyone provide insights to this?

/r/django
https://redd.it/106eh9x
How to avoid circular reference to SQLAlchemy.db.Model?

I have a module "resources" that facades access to my SQLAlchemy db. It has an "open" function that assigns a global db variable (simplified):

db = None

def open():
global db
db = SQLAlchemy(app)

I also have a module "models" defining my models, which includes code like:

class thing(resources.db.Model):
__tablename__ = "thing_table"
...

When I run the code, I get an error because before the open() function is called, db = None, so resources.db.Model is undefined.

> AttributeError: 'NoneType' object has no attribute 'Model'

How can I get the references right?

/r/flask
https://redd.it/106wiqi
Deployed gunicorn flask app to Render.com but slow startup

Normally, it is pretty quick to load the website. But whenever I don’t access the website in awhile, the workers exit, and so when I try to access the website again, the workers have to boot up again and it takes much longer. Is this normal? How do I make it so the load time after inactivity is quicker?

/r/flask
https://redd.it/106uz8g
Datatype bug when trying to update database

Hello,

I am trying to make a route that will update my database. However, the data is somehow being changed into a tuple instead of being a string. The stored data is a string. The data from the form is a string. However, when I go to update the existing data it is somehow a tuple?

@app.route("/character/<int:characterid>/edit-core-details", methods=["GET", "POST"])
def edit
corecharacterdetails(characterid):
campaigns = Campaign.query.all()
requested
character = Character.query.get(characterid)
form = forms.EditNameRaceClass()
if form.validate
onsubmit():
print("Before")
print(type(
requestedcharacter.name))
requestedcharacter.name = form.name.data,
print("After")
print(type(
requestedcharacter.name))
print("form data")
print(form.name.data)


/r/flask
https://redd.it/106cv2n
Monday Daily Thread: 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! If you're looking for project ideas, you might be interested in checking out Al Sweigart's, "The Big Book of Small Python Projects" which provides a list of projects and the code to make them work.

/r/Python
https://redd.it/106yoak
Fixing Python's "Cachetools" Library

"Cachetools" has become a cornerstone of Python cacheing libraries, but it has a few issues:

# 1. cachetools.LFUCache

Slow insertion times when the cache is full. When the cache is at capacity and a new item is inserted, the cache automatically handles eviction of the least frequently used item. Under the hood, cachetools uses a `Collections.Counter` object as it's interface to track item usage frequencies. When an item is evicted, Cachetools calls the `Counter.most_common()` API to retrieve the least frequently used item. This method creates a copy of the original underlying dictionary and sorts it by-key. Python uses `Timsort`, which is a O(n*logn) operation plus copy overhead. When the cache is large, this results in concerningly slow insertion times. With a cache size of 16384, median insertion times are \~0.6 microseconds (1e-6). When the cache is full, P90 and P99 insertion times are 540 and 600 microseconds (1e-6), a \~90,000% and \~100,000% increase from the median, respectively.

To solve this, `cacheing` implements an LFUCache API with O(1) insertions, deletions, and gets using a doubly linked list in the backend. This reduced P90 and P99 insertion times by \~45,000% and \~50,000%, respectively.

# 2. cachetools.TTLCache

This is a great time aware cache implementation. The issue is

/r/Python
https://redd.it/1077q6z
Thoughts on nested / inner functions in Python for better encapsulation and clarity?

Been loving Python for 7+ years not and still going strong. I recently found myself writing more and more inner functions to encapsulate logic easier and make otherwise rather polluting/dead functions stick out less.

I like it, because it allows me to write way cleaner and less bloated code – clustering helper-functions to only where they need to be. Also decreases cognitive load considerably by not having to keep track on where a helper function is being used.

But it has gotten to a point where I'm genuinely concerned, because I have also started defining lambdas in inner-functions too! I know lambda shouldn't be used and PEP checker complains too, but it's so handy when combined with list comprehensions…

What are your thoughts on this?
Do you use nested functions yourself or do you consider it bad practice? Where else do you put helpers?

---

An example would be the following code:

def sendmail(
*,
subject: str,
body
plain: str,
sendto: Union[List[str], str, List[User], User],
send
cc:

/r/Python
https://redd.it/106rsv8
High-Quality Numpy/PyTorch/Pandas Practice Problems

I've been finding Practice Probs an excellent resource for practice problems in Numpy over the last week after the creator u/neb2357's post about it here last week -- it's the closest thing I've found to LeetCode for data science. Thought I'd share in case others find it helpful to get a second opinion, and would love to hear if anyone knows of similar high-quality resources for these topics!

/r/Python
https://redd.it/106q8ux