How can I get IPython hon to indent with a tab character rather than spaces?
I've recently started using spyder and its embedded IPython console. Is there a separate option for the IPython console to change the indentation character?
/r/IPython
https://redd.it/7b535v
I've recently started using spyder and its embedded IPython console. Is there a separate option for the IPython console to change the indentation character?
/r/IPython
https://redd.it/7b535v
reddit
How can I get IPython hon to indent with a tab... • r/IPython
I've recently started using spyder and its embedded IPython console. Is there a separate option for the IPython console to change the indentation...
Preview of new flask based web framework / CMS - Manhattan
https://youtu.be/p8oAct-RW_0
/r/flask
https://redd.it/7b6vkd
https://youtu.be/p8oAct-RW_0
/r/flask
https://redd.it/7b6vkd
YouTube
Manhattan UI preview
A brief overview of the Manhattan web framework / CMS UI and some of the features available out the box.
Multiple phone numbers per contact
Hello, I'm trying to make a Customers and a Providers model, which both have almost all fields the same (name, address, email, etc..). Following the DRY concept, I decided to make an abstract class and use it as needed.
How could I add multiple phone numbers to the same Customer/Provider?
### What Have I tried?
Initially I made a phone number model and added a relation to the Abstract class, but that didn't work, so I read about generic foreign keys, which seems to achieve what Im looking for, except, I can't add the phone number model as an _inline_ for my Client class in the admin interface.
This is my models.py:
class Contacto(models.Model):
nombre = models.CharField(max_length=30)
email = models.EmailField(blank=True)
habilitado = models.BooleanField(default=True)
def __str__(self):
return self.nombre
class Meta:
abstract = True
ordering = ['nombre']
class Cliente(Contacto):
direccion_factura = models.CharField(blank=True, max_length=200)
class Proveedor(Contacto):
transportista = models.CharField(max_length=30)
class PhoneModel(models.Model):
content_type = models.ForeignKey(ContentType, on_delete=models.CASCADE)
object_id = models.PositiveIntegerField()
phone_regex = RegexValidator(regex=r'^\+?1?\d{9,15}$', message="Telefono debe ser ingresado en formato: '+999999999'. Permitido hasta 15 digitos.")
phone_number = models.CharField(validators=[phone_regex], max_length=15, blank=True) # validators should be a list
contacto = GenericForeignKey()
My problem is right here in admin.py:
class ContactoInline(admin.TabularInline):
model = PhoneModel
extra = 2
class ClienteAdmin(admin.ModelAdmin):
inlines = [ContactoInline]
admin.site.register(Cliente, ClienteAdmin)
admin.site.register(Proveedor)
Adding phone numbers to my Cliente/Proveedor class fail with:
ERRORS:
<class 'empresa.admin.ContactoInline'>: (admin.E202) 'empresa.PhoneModel' has no ForeignKey to 'empresa.Cliente'.
Ideally I'd like to have unlimited numbers per Client/Provider (because why should I limit the user?) but if that fails, id just hard code like 4 or 5 within the Abstract class.
Thanks
/r/django
https://redd.it/7ayxn1
Hello, I'm trying to make a Customers and a Providers model, which both have almost all fields the same (name, address, email, etc..). Following the DRY concept, I decided to make an abstract class and use it as needed.
How could I add multiple phone numbers to the same Customer/Provider?
### What Have I tried?
Initially I made a phone number model and added a relation to the Abstract class, but that didn't work, so I read about generic foreign keys, which seems to achieve what Im looking for, except, I can't add the phone number model as an _inline_ for my Client class in the admin interface.
This is my models.py:
class Contacto(models.Model):
nombre = models.CharField(max_length=30)
email = models.EmailField(blank=True)
habilitado = models.BooleanField(default=True)
def __str__(self):
return self.nombre
class Meta:
abstract = True
ordering = ['nombre']
class Cliente(Contacto):
direccion_factura = models.CharField(blank=True, max_length=200)
class Proveedor(Contacto):
transportista = models.CharField(max_length=30)
class PhoneModel(models.Model):
content_type = models.ForeignKey(ContentType, on_delete=models.CASCADE)
object_id = models.PositiveIntegerField()
phone_regex = RegexValidator(regex=r'^\+?1?\d{9,15}$', message="Telefono debe ser ingresado en formato: '+999999999'. Permitido hasta 15 digitos.")
phone_number = models.CharField(validators=[phone_regex], max_length=15, blank=True) # validators should be a list
contacto = GenericForeignKey()
My problem is right here in admin.py:
class ContactoInline(admin.TabularInline):
model = PhoneModel
extra = 2
class ClienteAdmin(admin.ModelAdmin):
inlines = [ContactoInline]
admin.site.register(Cliente, ClienteAdmin)
admin.site.register(Proveedor)
Adding phone numbers to my Cliente/Proveedor class fail with:
ERRORS:
<class 'empresa.admin.ContactoInline'>: (admin.E202) 'empresa.PhoneModel' has no ForeignKey to 'empresa.Cliente'.
Ideally I'd like to have unlimited numbers per Client/Provider (because why should I limit the user?) but if that fails, id just hard code like 4 or 5 within the Abstract class.
Thanks
/r/django
https://redd.it/7ayxn1
reddit
Multiple phone numbers per contact • r/django
Hello, I'm trying to make a Customers and a Providers model, which both have almost all fields the same (name, address, email, etc..). Following...
[D] Machine Learning - WAYR (What Are You Reading) - Week 35
This is a place to share machine learning research papers, journals, and articles that you're reading this week. If it relates to what you're researching, by all means elaborate and give us your insight, otherwise it could just be an interesting paper you've read.
Please try to provide some insight from your understanding and please don't post things which are present in wiki.
Preferably you should link the arxiv page (not the PDF, you can easily access the PDF from the summary page but not the other way around) or any other pertinent links.
Previous weeks :
|1-10|11-20|21-30|31-40|
|----|-----|-----|-----|
|[Week 1](https://www.reddit.com/r/MachineLearning/comments/4qyjiq/machine_learning_wayr_what_are_you_reading_week_1/)|[Week 11](https://www.reddit.com/r/MachineLearning/comments/57xw56/discussion_machine_learning_wayr_what_are_you/)|[Week 21](https://www.reddit.com/r/MachineLearning/comments/60ildf/d_machine_learning_wayr_what_are_you_reading_week/)|[Week 31](https://www.reddit.com/r/MachineLearning/comments/6s0k1u/d_machine_learning_wayr_what_are_you_reading_week/)||
|[Week 2](https://www.reddit.com/r/MachineLearning/comments/4s2xqm/machine_learning_wayr_what_are_you_reading_week_2/)|[Week 12](https://www.reddit.com/r/MachineLearning/comments/5acb1t/d_machine_learning_wayr_what_are_you_reading_week/)|[Week 22](https://www.reddit.com/r/MachineLearning/comments/64jwde/d_machine_learning_wayr_what_are_you_reading_week/)|[Week 32](https://www.reddit.com/r/MachineLearning/comments/72ab5y/d_machine_learning_wayr_what_are_you_reading_week/)||
|[Week 3](https://www.reddit.com/r/MachineLearning/comments/4t7mqm/machine_learning_wayr_what_are_you_reading_week_3/)|[Week 13](https://www.reddit.com/r/MachineLearning/comments/5cwfb6/d_machine_learning_wayr_what_are_you_reading_week/)|[Week 23](https://www.reddit.com/r/MachineLearning/comments/674331/d_machine_learning_wayr_what_are_you_reading_week/)|[Week 33](https://www.reddit.com/r/MachineLearning/comments/75405d/d_machine_learning_wayr_what_are_you_reading_week/)||
|[Week 4](https://www.reddit.com/r/MachineLearning/comments/4ub2kw/machine_learning_wayr_what_are_you_reading_week_4/)|[Week 14](https://www.reddit.com/r/MachineLearning/comments/5fc5mh/d_machine_learning_wayr_what_are_you_reading_week/)|[Week 24](https://www.reddit.com/r/MachineLearning/comments/68hhhb/d_machine_learning_wayr_what_are_you_reading_week/)|[Week 34](https://www.reddit.com/r/MachineLearning/comments/782js9/d_machine_learning_wayr_what_are_you_reading_week/)||
|[Week 5](https://www.reddit.com/r/MachineLearning/comments/4xomf7/machine_learning_wayr_what_are_you_reading_week_5/)|[Week 15](https://www.reddit.com/r/MachineLearning/comments/5hy4ur/d_machine_learning_wayr_what_are_you_reading_week/)|[Week 25](https://www.reddit.com/r/MachineLearning/comments/69teiz/d_machine_learning_wayr_what_are_you_reading_week/)||
|[Week 6](https://www.reddit.com/r/MachineLearning/comments/4zcyvk/machine_learning_wayr_what_are_you_reading_week_6/)|[Week 16](https://www.reddit.com/r/MachineLearning/comments/5kd6vd/d_machine_learning_wayr_what_are_you_reading_week/)|[Week 26](https://www.reddit.com/r/MachineLearning/comments/6d7nb1/d_machine_learning_wayr_what_are_you_reading_week/)||
|[Week 7](https://www.reddit.com/r/MachineLearning/comments/52t6mo/machine_learning_wayr_what_are_you_reading_week_7/)|[Week 17](https://www.reddit.com/r/MachineLearning/comments/5ob7dx/discussion_machine_learning_wayr_what_are_you/)|[Week 27](https://www.reddit.com/r/MachineLearning/comments/6gngwc/d_machine_learning_wayr_what_are_you_reading_week/)||
|[Week 8](https://www.reddit.com/r/MachineLearning/comments/53heol/machine_learning_wayr_what_are_you_reading_week_8/)|[Week 18](https://www.reddit.com/r/MachineLearning/comments/5r14yd/discussion_machine_learning_wayr_what_are_you/)|[Week 28](https://www.reddit.com/r/MachineLearning/comments/6jgdva/d_machine_learning_wayr_what_are_you_reading_week/)||
|[Week 9](https://www.reddit.com/r/MachineLearning/comments/54kvsu/machine_lear
This is a place to share machine learning research papers, journals, and articles that you're reading this week. If it relates to what you're researching, by all means elaborate and give us your insight, otherwise it could just be an interesting paper you've read.
Please try to provide some insight from your understanding and please don't post things which are present in wiki.
Preferably you should link the arxiv page (not the PDF, you can easily access the PDF from the summary page but not the other way around) or any other pertinent links.
Previous weeks :
|1-10|11-20|21-30|31-40|
|----|-----|-----|-----|
|[Week 1](https://www.reddit.com/r/MachineLearning/comments/4qyjiq/machine_learning_wayr_what_are_you_reading_week_1/)|[Week 11](https://www.reddit.com/r/MachineLearning/comments/57xw56/discussion_machine_learning_wayr_what_are_you/)|[Week 21](https://www.reddit.com/r/MachineLearning/comments/60ildf/d_machine_learning_wayr_what_are_you_reading_week/)|[Week 31](https://www.reddit.com/r/MachineLearning/comments/6s0k1u/d_machine_learning_wayr_what_are_you_reading_week/)||
|[Week 2](https://www.reddit.com/r/MachineLearning/comments/4s2xqm/machine_learning_wayr_what_are_you_reading_week_2/)|[Week 12](https://www.reddit.com/r/MachineLearning/comments/5acb1t/d_machine_learning_wayr_what_are_you_reading_week/)|[Week 22](https://www.reddit.com/r/MachineLearning/comments/64jwde/d_machine_learning_wayr_what_are_you_reading_week/)|[Week 32](https://www.reddit.com/r/MachineLearning/comments/72ab5y/d_machine_learning_wayr_what_are_you_reading_week/)||
|[Week 3](https://www.reddit.com/r/MachineLearning/comments/4t7mqm/machine_learning_wayr_what_are_you_reading_week_3/)|[Week 13](https://www.reddit.com/r/MachineLearning/comments/5cwfb6/d_machine_learning_wayr_what_are_you_reading_week/)|[Week 23](https://www.reddit.com/r/MachineLearning/comments/674331/d_machine_learning_wayr_what_are_you_reading_week/)|[Week 33](https://www.reddit.com/r/MachineLearning/comments/75405d/d_machine_learning_wayr_what_are_you_reading_week/)||
|[Week 4](https://www.reddit.com/r/MachineLearning/comments/4ub2kw/machine_learning_wayr_what_are_you_reading_week_4/)|[Week 14](https://www.reddit.com/r/MachineLearning/comments/5fc5mh/d_machine_learning_wayr_what_are_you_reading_week/)|[Week 24](https://www.reddit.com/r/MachineLearning/comments/68hhhb/d_machine_learning_wayr_what_are_you_reading_week/)|[Week 34](https://www.reddit.com/r/MachineLearning/comments/782js9/d_machine_learning_wayr_what_are_you_reading_week/)||
|[Week 5](https://www.reddit.com/r/MachineLearning/comments/4xomf7/machine_learning_wayr_what_are_you_reading_week_5/)|[Week 15](https://www.reddit.com/r/MachineLearning/comments/5hy4ur/d_machine_learning_wayr_what_are_you_reading_week/)|[Week 25](https://www.reddit.com/r/MachineLearning/comments/69teiz/d_machine_learning_wayr_what_are_you_reading_week/)||
|[Week 6](https://www.reddit.com/r/MachineLearning/comments/4zcyvk/machine_learning_wayr_what_are_you_reading_week_6/)|[Week 16](https://www.reddit.com/r/MachineLearning/comments/5kd6vd/d_machine_learning_wayr_what_are_you_reading_week/)|[Week 26](https://www.reddit.com/r/MachineLearning/comments/6d7nb1/d_machine_learning_wayr_what_are_you_reading_week/)||
|[Week 7](https://www.reddit.com/r/MachineLearning/comments/52t6mo/machine_learning_wayr_what_are_you_reading_week_7/)|[Week 17](https://www.reddit.com/r/MachineLearning/comments/5ob7dx/discussion_machine_learning_wayr_what_are_you/)|[Week 27](https://www.reddit.com/r/MachineLearning/comments/6gngwc/d_machine_learning_wayr_what_are_you_reading_week/)||
|[Week 8](https://www.reddit.com/r/MachineLearning/comments/53heol/machine_learning_wayr_what_are_you_reading_week_8/)|[Week 18](https://www.reddit.com/r/MachineLearning/comments/5r14yd/discussion_machine_learning_wayr_what_are_you/)|[Week 28](https://www.reddit.com/r/MachineLearning/comments/6jgdva/d_machine_learning_wayr_what_are_you_reading_week/)||
|[Week 9](https://www.reddit.com/r/MachineLearning/comments/54kvsu/machine_lear
Reddit
From the MachineLearning community on Reddit
Explore this post and more from the MachineLearning community
ning_wayr_what_are_you_reading_week_9/)|[Week 19](https://www.reddit.com/r/MachineLearning/comments/5tt9cz/discussion_machine_learning_wayr_what_are_you/)|[Week 29](https://www.reddit.com/r/MachineLearning/comments/6m9l1v/d_machine_learning_wayr_what_are_you_reading_week/)||
|[Week 10](https://www.reddit.com/r/MachineLearning/comments/56s2oa/discussion_machine_learning_wayr_what_are_you/)|[Week 20](https://www.reddit.com/r/MachineLearning/comments/5wh2wb/d_machine_learning_wayr_what_are_you_reading_week/)|[Week 30](https://www.reddit.com/r/MachineLearning/comments/6p3ha7/d_machine_learning_wayr_what_are_you_reading_week/)||
Most upvoted papers two weeks ago:
/u/alexbhandari: https://www.nature.com/nature/journal/v550/n7676/full/nature24270.html
/u/hlynurd: http://ccr.sigcomm.org/online/files/p83-keshavA.pdf
/u/cfusting: http://eplex.cs.ucf.edu/papers/morse_gecco16.pdf
Besides that, there are no rules, have fun.
/r/MachineLearning
https://redd.it/7b0av0
|[Week 10](https://www.reddit.com/r/MachineLearning/comments/56s2oa/discussion_machine_learning_wayr_what_are_you/)|[Week 20](https://www.reddit.com/r/MachineLearning/comments/5wh2wb/d_machine_learning_wayr_what_are_you_reading_week/)|[Week 30](https://www.reddit.com/r/MachineLearning/comments/6p3ha7/d_machine_learning_wayr_what_are_you_reading_week/)||
Most upvoted papers two weeks ago:
/u/alexbhandari: https://www.nature.com/nature/journal/v550/n7676/full/nature24270.html
/u/hlynurd: http://ccr.sigcomm.org/online/files/p83-keshavA.pdf
/u/cfusting: http://eplex.cs.ucf.edu/papers/morse_gecco16.pdf
Besides that, there are no rules, have fun.
/r/MachineLearning
https://redd.it/7b0av0
reddit
[Discussion] Machine Learning - WAYR (What Are You Reading) - Week 19
This is a place to share machine learning research papers, journals, and articles that you're reading this week. If it relates to what you're...
[django-rest-framework] How do you guys return error responses?
I started learning DRF recently, and one doubt has popped up. I was using **rest_framework.response.Response** to render the serialized data. However, I want to append a header to the response, so it's easier to check for and debug errors.
I was thinking something like this:
{
"errorCode": int,
"errorMessage": "...",
"payload": # serialized data
}
Would this be a good approach? Is there a way I can do this while remaining compatible with the "formats" option of the serializer? What approach to structuring the response you guys take when designing APIs?
/r/django
https://redd.it/7b85j1
I started learning DRF recently, and one doubt has popped up. I was using **rest_framework.response.Response** to render the serialized data. However, I want to append a header to the response, so it's easier to check for and debug errors.
I was thinking something like this:
{
"errorCode": int,
"errorMessage": "...",
"payload": # serialized data
}
Would this be a good approach? Is there a way I can do this while remaining compatible with the "formats" option of the serializer? What approach to structuring the response you guys take when designing APIs?
/r/django
https://redd.it/7b85j1
reddit
[django-rest-framework] How do you guys return error... • r/django
I started learning DRF recently, and one doubt has popped up. I was using **rest_framework.response.Response** to render the serialized data....
Great tool from Google just released. A Jupyter-based (and Google Drive) now makes easy collaboration and access from any Chrome browser. Thanks Google!
https://research.google.com/colaboratory/unregistered.html
/r/Python
https://redd.it/7b7k1k
https://research.google.com/colaboratory/unregistered.html
/r/Python
https://redd.it/7b7k1k
reddit
Great tool from Google just released. A Jupyter-based... • r/Python
147 points and 29 comments so far on reddit
Refresh on Django... book recommendations?
So, over the last two years, I became an intermediate Django developer. I felt like I could read and do almost anything in Django, but was way behind on the "right way" to do things. I changed jobs and spent a year away from programming and I feel like my skills are rusty.
I'd like to do a refresh on Django and I'd like to read a different book than I've read before. I've already read Two Scoops of Django and spent a lot of time in Django documentation.
Any recommendations?
/r/django
https://redd.it/7baea5
So, over the last two years, I became an intermediate Django developer. I felt like I could read and do almost anything in Django, but was way behind on the "right way" to do things. I changed jobs and spent a year away from programming and I feel like my skills are rusty.
I'd like to do a refresh on Django and I'd like to read a different book than I've read before. I've already read Two Scoops of Django and spent a lot of time in Django documentation.
Any recommendations?
/r/django
https://redd.it/7baea5
reddit
Refresh on Django... book recommendations? • r/django
So, over the last two years, I became an intermediate Django developer. I felt like I could read and do almost anything in Django, but was way...
How to train your own Object Detector with TensorFlow’s Object Detector API
https://medium.com/towards-data-science/how-to-train-your-own-object-detector-with-tensorflows-object-detector-api-bec72ecfe1d9
/r/Python
https://redd.it/7b6ygw
https://medium.com/towards-data-science/how-to-train-your-own-object-detector-with-tensorflows-object-detector-api-bec72ecfe1d9
/r/Python
https://redd.it/7b6ygw
Medium
How to train your own Object Detector with TensorFlow’s Object Detector API
This is a follow-up post on “Building a Real-Time Object Recognition App with Tensorflow and OpenCV” where I focus on training my own…
Advice for zero downtime deployments with Django
Hello!
I'm starting a new project where high availability is a priority (meaning no dropped HTTP requests). I was wondering what strategies would you recommend for zero downtime deployments?
I realize that complicated DB migrations would have to done in several steps (like removing a column).
Thank you for your advice.
/r/django
https://redd.it/7bc1tk
Hello!
I'm starting a new project where high availability is a priority (meaning no dropped HTTP requests). I was wondering what strategies would you recommend for zero downtime deployments?
I realize that complicated DB migrations would have to done in several steps (like removing a column).
Thank you for your advice.
/r/django
https://redd.it/7bc1tk
reddit
Advice for zero downtime deployments with Django • r/django
Hello! I'm starting a new project where high availability is a priority (meaning no dropped HTTP requests). I was wondering what strategies would...
Question about building an interactive website with Flask
I'm working on a project with the end goal of providing an interactive dashboard of statistical data from a PostgreSQL database.
* I have the Python scripts working to collect, parse and load the data into the database.
* I have the PostgreSQL code working to take the raw data and create the needed materialized views to present nice "tables" that have all the joins and such already done and the indexes needed for performance.
* I have a Flask+Flask-SQLAlchemy application setup that with the main layout, basic flat pages, and a first draft of the dashboard page that display a nicely formatted table of data from a predefined query hard-coded into the view to initialize the page with the most commonly requested data from the database.
But now I'm confused on how to make the website interactive to allow the user to, for example, select from icons in the sidebar to update the table of data based on what they want to see from the database.
I'd appreciate some pointers on different ways to provide this interactivity.
Searching Google isn't helping much because I don't know what to search for in the first place. All I'm finding is how to use Flask as a REST API with SPA frameworks like Angular/React doing all the front-end - not Flask specific solutions.
Edit: As a clarification - by interactivity I mean making choices that would set the parameters to use in the query of the data. The data is historical and read-only, so there won't be any user input forms.
/r/flask
https://redd.it/7b8y4n
I'm working on a project with the end goal of providing an interactive dashboard of statistical data from a PostgreSQL database.
* I have the Python scripts working to collect, parse and load the data into the database.
* I have the PostgreSQL code working to take the raw data and create the needed materialized views to present nice "tables" that have all the joins and such already done and the indexes needed for performance.
* I have a Flask+Flask-SQLAlchemy application setup that with the main layout, basic flat pages, and a first draft of the dashboard page that display a nicely formatted table of data from a predefined query hard-coded into the view to initialize the page with the most commonly requested data from the database.
But now I'm confused on how to make the website interactive to allow the user to, for example, select from icons in the sidebar to update the table of data based on what they want to see from the database.
I'd appreciate some pointers on different ways to provide this interactivity.
Searching Google isn't helping much because I don't know what to search for in the first place. All I'm finding is how to use Flask as a REST API with SPA frameworks like Angular/React doing all the front-end - not Flask specific solutions.
Edit: As a clarification - by interactivity I mean making choices that would set the parameters to use in the query of the data. The data is historical and read-only, so there won't be any user input forms.
/r/flask
https://redd.it/7b8y4n
reddit
Question about building an interactive website with Flask • r/flask
I'm working on a project with the end goal of providing an interactive dashboard of statistical data from a PostgreSQL database. * I have the...
[Help] Python KNN weighting during .predict()?
I'm using a KNN algorithm for a class (instructed to use this algorithm, may not what you'd expect for application, see below)
Essentially, we have a raspberry pi set up to collect the signal strengths of 6 local WIFI router Mac addresses. At different locations on a floor of our building we've recorded these signal strengths in .csv files.
Using python I've created a script which uses the functions on [this page](http://scikit-learn.org/stable/modules/generated/sklearn.neighbors.KNeighborsClassifier.html).
I fit a knn as below:
from sklearn.neighbors import KNeighborsClassifier
knn = KNeighborsClassifier(n_neighbors=1, algorithm = 'auto')
knn.fit(strengths, labels)
where strengths is a nested array like this:
[[Loc1strengths],[Loc2strengths],[Loc3strengths],[Loc4strengths],[Loc5strengths],[Loc6strengths]]
labels is set up like this:
[Loc1, Loc2, Loc3, Loc4, Loc5, Loc6]
Later in the script, I collect the signal strengths of the 6 local WIFI router Mac addresses and try to predict the location of my pi using knn.predict() and hope to get the location of the pi, Location1 for example.
The results aren't great, it does a relatively poor job of figuring out where it is.
I was wondering if there was a way to weight the function of knn.predict() so that the neighbors of the most recent location are weighted more heavily, the pi won't move to the other side of the floor without crossing the other points.
Any help would be appreciated!
/r/pystats
https://redd.it/7baulc
I'm using a KNN algorithm for a class (instructed to use this algorithm, may not what you'd expect for application, see below)
Essentially, we have a raspberry pi set up to collect the signal strengths of 6 local WIFI router Mac addresses. At different locations on a floor of our building we've recorded these signal strengths in .csv files.
Using python I've created a script which uses the functions on [this page](http://scikit-learn.org/stable/modules/generated/sklearn.neighbors.KNeighborsClassifier.html).
I fit a knn as below:
from sklearn.neighbors import KNeighborsClassifier
knn = KNeighborsClassifier(n_neighbors=1, algorithm = 'auto')
knn.fit(strengths, labels)
where strengths is a nested array like this:
[[Loc1strengths],[Loc2strengths],[Loc3strengths],[Loc4strengths],[Loc5strengths],[Loc6strengths]]
labels is set up like this:
[Loc1, Loc2, Loc3, Loc4, Loc5, Loc6]
Later in the script, I collect the signal strengths of the 6 local WIFI router Mac addresses and try to predict the location of my pi using knn.predict() and hope to get the location of the pi, Location1 for example.
The results aren't great, it does a relatively poor job of figuring out where it is.
I was wondering if there was a way to weight the function of knn.predict() so that the neighbors of the most recent location are weighted more heavily, the pi won't move to the other side of the floor without crossing the other points.
Any help would be appreciated!
/r/pystats
https://redd.it/7baulc
reddit
[Help] Python KNN weighting during .predict()? • r/pystats
I'm using a KNN algorithm for a class (instructed to use this algorithm, may not what you'd expect for application, see below) Essentially, we...
RISE 5.1.0 is out! This is the reveal.js interactive slideshow environment for the Jupyter notebook!
http://www.damian.oquanta.info/posts/rise-510-is-out.html
/r/IPython
https://redd.it/7bcszh
http://www.damian.oquanta.info/posts/rise-510-is-out.html
/r/IPython
https://redd.it/7bcszh
Damian's blog
RISE 5.1.0 is out!
We're pleased to announce the release of RISE 5.1.0!
RISE allows you show your Jupyter notebooks rendered as an executable Reveal.js-based slideshow. It is your very same notebook but presented in a s
RISE allows you show your Jupyter notebooks rendered as an executable Reveal.js-based slideshow. It is your very same notebook but presented in a s
How can I use a rich text editor in a django blog admin?
I am creating a dynamic blog using Django. I would like to enable the user of this blog to format the blog posts very easily using a rich text editor. How can I implement it with this Django blog admin?
/r/djangolearning
https://redd.it/7b6p83
I am creating a dynamic blog using Django. I would like to enable the user of this blog to format the blog posts very easily using a rich text editor. How can I implement it with this Django blog admin?
/r/djangolearning
https://redd.it/7b6p83
reddit
How can I use a rich text editor in a django... • r/djangolearning
I am creating a dynamic blog using Django. I would like to enable the user of this blog to format the blog posts very easily using a rich text...
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/7bddxy
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/7bddxy
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...
Interfacing Python and C: Advanced “ctypes” Features
https://dbader.org/blog/python-ctypes-tutorial-part-2#intro
/r/Python
https://redd.it/7bdiye
https://dbader.org/blog/python-ctypes-tutorial-part-2#intro
/r/Python
https://redd.it/7bdiye
dbader.org
Interfacing Python and C: Advanced “ctypes” Features – dbader.org
Learn advanced patterns for interfacing Python with native libraries, like dealing with C structs from Python and pass-by-value versus pass-by-reference semantics.
Practical Python List Comprehension Tutorial
https://www.datacamp.com/community/tutorials/python-list-comprehension?utm_source=reddit&utm_campaign=python_list
/r/Python
https://redd.it/7bemz6
https://www.datacamp.com/community/tutorials/python-list-comprehension?utm_source=reddit&utm_campaign=python_list
/r/Python
https://redd.it/7bemz6
DataCamp Community
Python List Comprehension Tutorial
Learn how to effectively use list comprehension in Python to create lists, to replace (nested) for loops and the map(), filter() and reduce() functions, ...!
How does a beginner learn Machine Learning?
I usually use R for my work and have a tiny bit of experience with Python. What's the best way for me to go about getting Python under my belt with the goal of mastering basic concepts in machine learning?
Specifically, I'm asking for suggestions in online courses, but also how should I think about this? Any advice is welcome. Thanks!
/r/Python
https://redd.it/7bextj
I usually use R for my work and have a tiny bit of experience with Python. What's the best way for me to go about getting Python under my belt with the goal of mastering basic concepts in machine learning?
Specifically, I'm asking for suggestions in online courses, but also how should I think about this? Any advice is welcome. Thanks!
/r/Python
https://redd.it/7bextj
reddit
How does a beginner learn Machine Learning? • r/Python
I usually use R for my work and have a tiny bit of experience with Python. What's the best way for me to go about getting Python under my belt...
Trying to get a template/link working in Mezzanine
Hey all,
I'm working on a Mezzanine project. I made a `ProjectLinkPage` class that inherits from Mezzanine's Displayable class. I logged into the Admin section and added a `ProjectLinkPage` object with the slug "some-content." I want to open the template `some-content.html` by going to "http://127.0.0.1:8000/projects/some-content." This does not work. I get a 404 error.
Here's how my directory looks.
myProject/
- myProject/
-- urls.py
- theme/
-- models.py
-- views.py
-- templates/
--- pages/
---- project_pages/
----- project_base.html
----- projects/
------ some-content.html
My `models.py` looks like this:
class ProjectLinkPage(Displayable)
# Fields and `class Meta`, etc...
@models.permalink
def get_absolute_url(self):
return ("project_detail", (), {"slug": self.slug})
`views.py`:
def project_detail(request, slug, template="project_pages/project_base.html", extra_context=None):
project = get_object_or_404(Project, slug=slug, status=2)
context = {
"project": project,
"editable_obj": project
}
context.update(extra_context or {})
templates = [u"project_pages/projects/%s.html" % str(slug), template]
return TemplateResponse(request, templates, context)
`urls.py`:
`url("^projects/(?P<slug>.*)%s$" % _slash, project_detail, name="project_detail"),`.
Have I missed something in these files? What must I change for my browser to correctly locate the `some-content.html` template when I go to "http://127.0.0.1:8000/projects/some-content?"
/r/django
https://redd.it/7bfvm3
Hey all,
I'm working on a Mezzanine project. I made a `ProjectLinkPage` class that inherits from Mezzanine's Displayable class. I logged into the Admin section and added a `ProjectLinkPage` object with the slug "some-content." I want to open the template `some-content.html` by going to "http://127.0.0.1:8000/projects/some-content." This does not work. I get a 404 error.
Here's how my directory looks.
myProject/
- myProject/
-- urls.py
- theme/
-- models.py
-- views.py
-- templates/
--- pages/
---- project_pages/
----- project_base.html
----- projects/
------ some-content.html
My `models.py` looks like this:
class ProjectLinkPage(Displayable)
# Fields and `class Meta`, etc...
@models.permalink
def get_absolute_url(self):
return ("project_detail", (), {"slug": self.slug})
`views.py`:
def project_detail(request, slug, template="project_pages/project_base.html", extra_context=None):
project = get_object_or_404(Project, slug=slug, status=2)
context = {
"project": project,
"editable_obj": project
}
context.update(extra_context or {})
templates = [u"project_pages/projects/%s.html" % str(slug), template]
return TemplateResponse(request, templates, context)
`urls.py`:
`url("^projects/(?P<slug>.*)%s$" % _slash, project_detail, name="project_detail"),`.
Have I missed something in these files? What must I change for my browser to correctly locate the `some-content.html` template when I go to "http://127.0.0.1:8000/projects/some-content?"
/r/django
https://redd.it/7bfvm3
reddit
Trying to get a template/link working in Mezzanine • r/django
Hey all, I'm working on a Mezzanine project. I made a `ProjectLinkPage` class that inherits from Mezzanine's Displayable class. I logged into the...