Posts

Showing posts with the label python

(DRAFT) Scaling a django project using celery and elasticsearch

Scalability has undoubtedly become an important asset not only for large software projects but also mid-level ones now. Indeed, when you have a look at developer job posts, you can see easily that the need to build scalable software is one of the top desired skills. Making a software scalable requires mostly more than one methodology and different technology stacks. At first, it may look difficult and require deep experience with those methods and stacks. And yes, scalability is a serious topic. Although it is, in this post, I will show how to make a Django application scalable. In the end, you will learn fundamental concepts and approaches. PLAN create a django project which is a little product management system. make adding product asynchronous instead of synchronous sync elasticsearch with the primary database ( SQLite ) use elasticsearch for autocomplete and real-time analysis 1. Product management app with Django Since I assume you are familiar with Python an...

Euclidean Distance (similarity)

Bir kümedeki elementlerin benzerliğini ölçen, benzerlik puanı üreten avantajı ve dezavantajı duruma göre değişen algoritmalar bulunmaktadır. Collaborative Intelligence kitabında Euclidean Distance hesaplaması ile film eleştirmenleri arasındaki benzerlik hesaplanmıştır. Senaryoda, kişiler çeşitli filmlere puan vermişlerdir ve bu puanlar üzerinden bir kişinin diğer insanlarla arasındaki benzerlik hesaplanmıştır.Birkaç ekleme dışında kodların tamamını kitaptaki gibi aktarıyorum. from math import sqrt def sim_euclidan_distance(prefs, person1, person2): si={} for item in prefs[person1]: if item in prefs[person2]: si[item]=1 if len(si)==0: return 0 sum_of_squares=sum([ pow( prefs[person1][item]-prefs[person2][item], 2) for item in prefs[person1] if item in prefs[person2] ]) return 1/(1+sqrt(sum_of_squares)) critics={ 'Mustafa': { "The Matrix": 5, "The Godfather": 5, "Se7en": 3, "Babel": 2, "Troy": 4, ...

Migrating from PHP to Python

At last, I’ve made a strong decision to migrate from PHP to Python. Leaving a tool, leaving your bread basket would not be an easy decision if you used it almost for eight years. Otherwise, I believe that sometimes with a little bit courage to leave your conform zone and a lot of curiosity you can get a better bread basket, maybe a jar of jam too. if you want to be a sea, you must give up being a drop. Why am I leaving PHP? Actually I am not leaving PHP totally, but switching my primary language to Python because my works have been changing. Most of work required from me is related to natural language processing(NLP), machine learning(ML) techniques. And I, and many other developers, find Python much more capable to deal with this kind of works. It has already many libraries, tools, frameworks for NLP and ML. Another reason is that I think web programming will not grow as much as an intelligent system. Maybe I am wrong, but there is no doubt the future is about intelligent syste...