Computing S-value from R-squared for SVM?
I split a dataset consisting of 3 columns for `X` and 1 column for `y`.
X_train, X_test, y_train, y_test = cross_validation.train_test_split(X, y, test_size=0.25)
I then a support vector regression model to generate predictions
clf = svm.SVR(kernel='linear')
clf.fit(X_train, y_train)
y_pred = clf.predict(X_test)
I then computed the R-squared value
r2_score(y_pred, y_test)
How do I then compute the S-value? Is it just `stdev(y_pred)*sqrt(1-R^2)`
/r/pystats
https://redd.it/6vc06t
I split a dataset consisting of 3 columns for `X` and 1 column for `y`.
X_train, X_test, y_train, y_test = cross_validation.train_test_split(X, y, test_size=0.25)
I then a support vector regression model to generate predictions
clf = svm.SVR(kernel='linear')
clf.fit(X_train, y_train)
y_pred = clf.predict(X_test)
I then computed the R-squared value
r2_score(y_pred, y_test)
How do I then compute the S-value? Is it just `stdev(y_pred)*sqrt(1-R^2)`
/r/pystats
https://redd.it/6vc06t
reddit
Computing S-value from R-squared for SVM? • r/pystats
I split a dataset consisting of 3 columns for `X` and 1 column for `y`. X_train, X_test, y_train, y_test =...
How can I enable file path autocompletion in the IPython console in PyCharm?
(No sure this is the appropriate place to ask this question - but I find no better one. I did ask of it on StackOverflow.)
Path autocompletion in the IPython console in PyCharm does not work well:
c:/U<TAB>
should autocomplete to:
cd c:/Users/
on my machine; instead, the best it manages is:
cd c:/UserWarning
which is plain wrong. IPython in the Anaconda prompt, however, behaves as it should.
My strong assumption is that this is due to PyCharm not using the standard IPython configuration files.
I'm aware of the console starting script ins PyCharm:
Settings->Build, Execution, Deployment->Console->Python console
and I've successfully used it to activate a simple magic command I've written.
So here my question: is there a code configuration snippet that could be inserted there, and that could just enable file path autocompletion? Or a pointer to a general description on how IPython configuration files "work", that would enable me to figure it out myself? That is, I imagine, the most doable hack that would solve the problem for the time being.
Alternatively, any experiences with writing your own autocompletion using the following libraries:
IPython.core.completer
IPython.core.completerlib
?
Is that doable? How much work can that be?
Thanks in advance!
Links supporting claims in the question(s) above:
1) Autocompletion in IPython console in PyCharm not working as it should
On StackOverflow there are three questions with similar wording, but not one substantial answer:
https://stackoverflow.com/questions/32542289/pycharm-ipython-tab-completion-not-working-within-python-console
https://stackoverflow.com/questions/35612338/how-to-set-ipython-profile-in-pycharm
https://stackoverflow.com/questions/32458158/pycharm-python-console-autocompletion
(No, using Ctrl+Space instead of Tab does not solve anything.)
JetBrains (creators of PyCharm) know about this since, at least, two years:
https://intellij-support.jetbrains.com/hc/en-us/community/posts/205820389-Console-tab-completion-
and seems to have started working on it, but never finished it. Discussion states " this is only the initial step to getting full IPython tab completions": https://youtrack.jetbrains.com/issue/PY-9345 . But the issue is closed since October 2016: https://github.com/JetBrains/intellij-community/pull/440
2) PyCharm not using ipython_config.py to configure IPython Console:
https://intellij-support.jetbrains.com/hc/en-us/community/posts/206603035-Which-ipython-config-py-is-used-to-configure-IPython-for-Python-Console-
My setup:
PyCharm Community Edition 2017.2.1
Anaconda 2 (Python 2.7), version 4.3.22
which contains
IPython 5.1.0
on Windows 7 Professional N
/r/IPython
https://redd.it/6vanpr
(No sure this is the appropriate place to ask this question - but I find no better one. I did ask of it on StackOverflow.)
Path autocompletion in the IPython console in PyCharm does not work well:
c:/U<TAB>
should autocomplete to:
cd c:/Users/
on my machine; instead, the best it manages is:
cd c:/UserWarning
which is plain wrong. IPython in the Anaconda prompt, however, behaves as it should.
My strong assumption is that this is due to PyCharm not using the standard IPython configuration files.
I'm aware of the console starting script ins PyCharm:
Settings->Build, Execution, Deployment->Console->Python console
and I've successfully used it to activate a simple magic command I've written.
So here my question: is there a code configuration snippet that could be inserted there, and that could just enable file path autocompletion? Or a pointer to a general description on how IPython configuration files "work", that would enable me to figure it out myself? That is, I imagine, the most doable hack that would solve the problem for the time being.
Alternatively, any experiences with writing your own autocompletion using the following libraries:
IPython.core.completer
IPython.core.completerlib
?
Is that doable? How much work can that be?
Thanks in advance!
Links supporting claims in the question(s) above:
1) Autocompletion in IPython console in PyCharm not working as it should
On StackOverflow there are three questions with similar wording, but not one substantial answer:
https://stackoverflow.com/questions/32542289/pycharm-ipython-tab-completion-not-working-within-python-console
https://stackoverflow.com/questions/35612338/how-to-set-ipython-profile-in-pycharm
https://stackoverflow.com/questions/32458158/pycharm-python-console-autocompletion
(No, using Ctrl+Space instead of Tab does not solve anything.)
JetBrains (creators of PyCharm) know about this since, at least, two years:
https://intellij-support.jetbrains.com/hc/en-us/community/posts/205820389-Console-tab-completion-
and seems to have started working on it, but never finished it. Discussion states " this is only the initial step to getting full IPython tab completions": https://youtrack.jetbrains.com/issue/PY-9345 . But the issue is closed since October 2016: https://github.com/JetBrains/intellij-community/pull/440
2) PyCharm not using ipython_config.py to configure IPython Console:
https://intellij-support.jetbrains.com/hc/en-us/community/posts/206603035-Which-ipython-config-py-is-used-to-configure-IPython-for-Python-Console-
My setup:
PyCharm Community Edition 2017.2.1
Anaconda 2 (Python 2.7), version 4.3.22
which contains
IPython 5.1.0
on Windows 7 Professional N
/r/IPython
https://redd.it/6vanpr
Stackoverflow
Pycharm IPython tab completion not working (within python console)
So I have searched high and low for an answer regarding this and I am starting to come to the conclusion that it simply isn't a feature for Pycharm.
I am using IPython in Pycharm and I cannot ge...
I am using IPython in Pycharm and I cannot ge...
COUNTLESS — High Performance 2x Downsampling of Labeled Images Using Python and Numpy
https://medium.com/towards-data-science/countless-high-performance-2x-downsampling-of-labeled-images-using-python-and-numpy-e70ad3275589
/r/pystats
https://redd.it/6vds8q
https://medium.com/towards-data-science/countless-high-performance-2x-downsampling-of-labeled-images-using-python-and-numpy-e70ad3275589
/r/pystats
https://redd.it/6vds8q
Medium
COUNTLESS — High Performance 2x Downsampling of Labeled Images Using Python and Numpy
Downsample labeled segmentations by taking the mode of 2x2 blocks using only Python and numpy. This was first used in a pipeline for generating MIP levels on AI segmentations of brain tissue.
What's everyone working on this week?
Tell /r/python what you're working on this week! You can be bragging, grousing, sharing your passion, or explaining your pain. Talk about your current project or your pet project; whatever you want to share.
/r/Python
https://redd.it/6vb9c5
Tell /r/python what you're working on this week! You can be bragging, grousing, sharing your passion, or explaining your pain. Talk about your current project or your pet project; whatever you want to share.
/r/Python
https://redd.it/6vb9c5
reddit
What's everyone working on this week? • r/Python
Tell /r/python what you're working on this week! You can be bragging, grousing, sharing your passion, or explaining your pain. Talk about your...
Library which provide mock data for any purpose. From cryptographical data to personal data.
https://github.com/lk-geimfari/mimesis
/r/Python
https://redd.it/6vb4n0
https://github.com/lk-geimfari/mimesis
/r/Python
https://redd.it/6vb4n0
GitHub
GitHub - lk-geimfari/mimesis: Mimesis is a fast Python library for generating fake data in multiple languages.
Mimesis is a fast Python library for generating fake data in multiple languages. - lk-geimfari/mimesis
For my first Django project, I created a site to help you find quality Software Development / CS books!
Hey guys, as my first Django project I created a website that scrapes data from Reddit, aggregates, categorises and ranks every book mentioned each day based on the karma of the author, upvotes received by the comment and some other factors.
You can check it out here: http://reddittopbooks.com.
Getting up to speed with Django with a fair bit of Python experience took me around 2 days, I mainly used to official tutorial as a starting point. Check out the about section for more info on the site!
/r/django
https://redd.it/6vckcz
Hey guys, as my first Django project I created a website that scrapes data from Reddit, aggregates, categorises and ranks every book mentioned each day based on the karma of the author, upvotes received by the comment and some other factors.
You can check it out here: http://reddittopbooks.com.
Getting up to speed with Django with a fair bit of Python experience took me around 2 days, I mainly used to official tutorial as a starting point. Check out the about section for more info on the site!
/r/django
https://redd.it/6vckcz
Reddittopbooks
Reddit Top Books
Weekly toplist of the most mentioned books across various subreddits, categorized.
Auto populating modified_by and created_by fields
In addition to tracking created_at and modified_at, I'd like to log the created_by and modified_by user (I'm using Flask-Login). Is there a nice way to do this? I'm having a hell of a time figuring out how to do it automatically in the model.
My current solution is to catch the user in the view and set the variable that way, but it feels wrong. I don't know how to access current_user from the model, and can't find any documentation on how to do this. It seems like it should be a pretty normal design pattern.
Any hints would be super helpful. I'm not looking for code, just any ideas of how to do this more cleanly.
Thanks,
Mark
/r/flask
https://redd.it/6vdpzi
In addition to tracking created_at and modified_at, I'd like to log the created_by and modified_by user (I'm using Flask-Login). Is there a nice way to do this? I'm having a hell of a time figuring out how to do it automatically in the model.
My current solution is to catch the user in the view and set the variable that way, but it feels wrong. I don't know how to access current_user from the model, and can't find any documentation on how to do this. It seems like it should be a pretty normal design pattern.
Any hints would be super helpful. I'm not looking for code, just any ideas of how to do this more cleanly.
Thanks,
Mark
/r/flask
https://redd.it/6vdpzi
reddit
Auto populating modified_by and created_by fields • r/flask
In addition to tracking created_at and modified_at, I'd like to log the created_by and modified_by user (I'm using Flask-Login). Is there a nice...
How to include scraper as part of django project
I am making a site that will require a scraper to run continuously and watch for changes on an api.
Once a change occurs, it needs to get the change, and push it to a database which is defined by a django model. I am not sure how i can create this structure. Should the scraper be part of django somehow? Should it be a micro service somewhere, but then how do I use djangos ORM to get the models and save them down.
Can anyone point me in the right direction for this?
/r/django
https://redd.it/6vgtv9
I am making a site that will require a scraper to run continuously and watch for changes on an api.
Once a change occurs, it needs to get the change, and push it to a database which is defined by a django model. I am not sure how i can create this structure. Should the scraper be part of django somehow? Should it be a micro service somewhere, but then how do I use djangos ORM to get the models and save them down.
Can anyone point me in the right direction for this?
/r/django
https://redd.it/6vgtv9
reddit
How to include scraper as part of django project • r/django
I am making a site that will require a scraper to run continuously and watch for changes on an api. Once a change occurs, it needs to get the...
Hey /r/Python! I made a weird game about simulating evolution of intelligence in PyGame. Tell me what you think!
https://www.youtube.com/watch?v=2boI6R0Gx8A
/r/Python
https://redd.it/6vdaiv
https://www.youtube.com/watch?v=2boI6R0Gx8A
/r/Python
https://redd.it/6vdaiv
YouTube
Critter Evolution - A game for bored nerds
Subscribe for more robotics/software projects!
I made an evolutionary game where the brains of critters get smarter over time. The critters live, mate, eat, hunt, scavenge, sleep, and die. When they mate, their decision-making process is put into the child…
I made an evolutionary game where the brains of critters get smarter over time. The critters live, mate, eat, hunt, scavenge, sleep, and die. When they mate, their decision-making process is put into the child…
Django and concurrent database access
I'm fairly new to developing with Django. As it happens I am using Celery for asynchronous task handling, but I think this question could pertain to Django even without Celery.
In the situation where Apache or Gunicorn is configured to handle multiple requests simultaneously, one can conceivably have the situation where one request is reading from the database to generate a view while another is either writing or even deleting content.
Now at least the way my code is written, the read request may need to query multiple models - often doing a filter on a second model based on some logic using values read from the first model. At a minimum such a relationship may even simply be a foreign key constraint in the database.
So I believe multiple database accesses may happen while generating the view for the user who is making the query.
Right now I presume that my code will crash should another process (be it a Django instance or perhaps a Celery async task) be modifying or deleting entries from the database (for example another user is logged in and has requested some entries to be deleted).
What is a good way to deal with this?
/r/django
https://redd.it/6ve3wp
I'm fairly new to developing with Django. As it happens I am using Celery for asynchronous task handling, but I think this question could pertain to Django even without Celery.
In the situation where Apache or Gunicorn is configured to handle multiple requests simultaneously, one can conceivably have the situation where one request is reading from the database to generate a view while another is either writing or even deleting content.
Now at least the way my code is written, the read request may need to query multiple models - often doing a filter on a second model based on some logic using values read from the first model. At a minimum such a relationship may even simply be a foreign key constraint in the database.
So I believe multiple database accesses may happen while generating the view for the user who is making the query.
Right now I presume that my code will crash should another process (be it a Django instance or perhaps a Celery async task) be modifying or deleting entries from the database (for example another user is logged in and has requested some entries to be deleted).
What is a good way to deal with this?
/r/django
https://redd.it/6ve3wp
reddit
Django and concurrent database access • r/django
I'm fairly new to developing with Django. As it happens I am using Celery for asynchronous task handling, but I think this question could pertain...
The Needle in the Haystack: Wrangling Celery Workflows
https://engineering.rover.com/blog/ops/2017/08/21/wrangling-celery-workflows/
/r/django
https://redd.it/6vbz1s
https://engineering.rover.com/blog/ops/2017/08/21/wrangling-celery-workflows/
/r/django
https://redd.it/6vbz1s
Rover.com
One-Column Layout | Rover.com
Find 5 star dog sitters on Rover.com. Book dog sitting or dog boarding online! 24/7 customer support, peace of mind protection. Better than a dog kennel.
The simple way to understand Django models
https://arevej.me/django-models/
/r/djangolearning
https://redd.it/6vblnc
https://arevej.me/django-models/
/r/djangolearning
https://redd.it/6vblnc
reddit
The simple way to understand Django models • r/djangolearning
7 points and 3 comments so far on reddit
How do you format text that was taken from a model field?
I'm not even sure how to ask this question so I apologize if this is an easy Google. I am at least pretty sure it's Django-related.
This is a basic blog. Here is the relevant model structure:
class Post(models.Model):
title = models.CharField(max_length=100)
slug = models.SlugField(max_length=100)
body = models.TextField()
posted_date = models.DateField(auto_now_add=True)
category = models.ManyToManyField('Category')
Each instance of the above model I am calling "p." So now in my template, I am printing the title and body of the post:
...
<h3>{{ p.title|safe }}</h3>
<h6>Posted on {{ p.posted_date }}</h6>
<p>{{ p.body|safe }}</p>
...
This is all working just fine. My problem is, when I actually load all of this in my browser, no matter what styling I do to
<p>{{ p.body|safe }}</p>
it does not take. Boostrap classes don't work. Custom CSS doesn't work. In-line CSS doesn't work. Am I missing something?
/r/django
https://redd.it/6vffny
I'm not even sure how to ask this question so I apologize if this is an easy Google. I am at least pretty sure it's Django-related.
This is a basic blog. Here is the relevant model structure:
class Post(models.Model):
title = models.CharField(max_length=100)
slug = models.SlugField(max_length=100)
body = models.TextField()
posted_date = models.DateField(auto_now_add=True)
category = models.ManyToManyField('Category')
Each instance of the above model I am calling "p." So now in my template, I am printing the title and body of the post:
...
<h3>{{ p.title|safe }}</h3>
<h6>Posted on {{ p.posted_date }}</h6>
<p>{{ p.body|safe }}</p>
...
This is all working just fine. My problem is, when I actually load all of this in my browser, no matter what styling I do to
<p>{{ p.body|safe }}</p>
it does not take. Boostrap classes don't work. Custom CSS doesn't work. In-line CSS doesn't work. Am I missing something?
/r/django
https://redd.it/6vffny
reddit
How do you format text that was taken from a model field? • r/django
I'm not even sure how to ask this question so I apologize if this is an easy Google. I am at least pretty sure it's Django-related. This...
UserProfile: Should be another app or just a model?
I thinking of doing a Pinterest clone and maybe that others clone projects like Reddit, Instagram or Hacker News. And I wondering if is better have the user profile like an app or just a model in the general view.
Also, what kind of things I can put on it? bio, avatar, or something like that?
/r/django
https://redd.it/6vj9yr
I thinking of doing a Pinterest clone and maybe that others clone projects like Reddit, Instagram or Hacker News. And I wondering if is better have the user profile like an app or just a model in the general view.
Also, what kind of things I can put on it? bio, avatar, or something like that?
/r/django
https://redd.it/6vj9yr
reddit
UserProfile: Should be another app or just a model? • r/django
I thinking of doing a Pinterest clone and maybe that others clone projects like Reddit, Instagram or Hacker News. And I wondering if is better...
[Opening] Flask Dev Wanted for Open Source Project
I am looking for an experienced Flask developer to create a poc web app. The developed app will be open sourced for further development. Compensation offered in Bitcoin or Monero. PM for more details. Thx.
/r/flask
https://redd.it/6vlmpx
I am looking for an experienced Flask developer to create a poc web app. The developed app will be open sourced for further development. Compensation offered in Bitcoin or Monero. PM for more details. Thx.
/r/flask
https://redd.it/6vlmpx
reddit
[Opening] Flask Dev Wanted for Open Source Project • r/flask
I am looking for an experienced Flask developer to create a poc web app. The developed app will be open sourced for further development....
A large list of interesting open source projects in Python. Only active and interesting projects!
https://github.com/lk-geimfari/awesomo/blob/master/languages/PYTHON.md
/r/Python
https://redd.it/6vilsp
https://github.com/lk-geimfari/awesomo/blob/master/languages/PYTHON.md
/r/Python
https://redd.it/6vilsp
GitHub
awesomo/languages/PYTHON.md at main · lk-geimfari/awesomo
Cool open source projects. Choose your project and get involved in Open Source development now. - lk-geimfari/awesomo
[R] High Quality 3D Object Reconstruction from a Single Color Image
http://bair.berkeley.edu/blog/2017/08/23/high-quality-3d-obj-reconstruction/
/r/MachineLearning
https://redd.it/6vjzte
http://bair.berkeley.edu/blog/2017/08/23/high-quality-3d-obj-reconstruction/
/r/MachineLearning
https://redd.it/6vjzte
The Berkeley Artificial Intelligence Research Blog
High Quality 3D Object Reconstruction from a Single Color Image
The BAIR Blog
[AF]Need assistance building joined SQLAlchemy queries. Willing to compensate.
Long story short I'm building an application for a client and I have 4 tables (Customer, Materials, Hours, Attachments) backref'd to a Workorder table, and all linked in a link_table.
It's fully functional and working fine, however I need to build a filter / query system so my client can run reports such as X employee's hours between Y dates, or X employee's hours between Y dates where customer = Z.
Most queries I've run into with SQLAlchemy I've been able to build just fine, even filters using kwargs, however I don't have the time to figure out joining tables, querying backrefs etc. as I've got other modules to focus on for this project, and I need to present it by Friday.
If someone would be willing to help I can throw a few bucks your way. My code is clean and if you've done this before it shouldn't take you very long at all.
Thanks!
/r/flask
https://redd.it/6vkmto
Long story short I'm building an application for a client and I have 4 tables (Customer, Materials, Hours, Attachments) backref'd to a Workorder table, and all linked in a link_table.
It's fully functional and working fine, however I need to build a filter / query system so my client can run reports such as X employee's hours between Y dates, or X employee's hours between Y dates where customer = Z.
Most queries I've run into with SQLAlchemy I've been able to build just fine, even filters using kwargs, however I don't have the time to figure out joining tables, querying backrefs etc. as I've got other modules to focus on for this project, and I need to present it by Friday.
If someone would be willing to help I can throw a few bucks your way. My code is clean and if you've done this before it shouldn't take you very long at all.
Thanks!
/r/flask
https://redd.it/6vkmto
reddit
[AF]Need assistance building joined SQLAlchemy queries.... • r/flask
Long story short I'm building an application for a client and I have 4 tables (Customer, Materials, Hours, Attachments) backref'd to a Workorder...
I made a real-time python IDE. Anyone have any feedback?
https://github.com/Almenon/AREPL
see it in action below!
https://puu.sh/x1a1U/1fdfd3899c.gif
/r/Python
https://redd.it/6vodl4
https://github.com/Almenon/AREPL
see it in action below!
https://puu.sh/x1a1U/1fdfd3899c.gif
/r/Python
https://redd.it/6vodl4
GitHub
Almenon/AREPL
AREPL - python scratchpad with real-time code evaluation