First, case backgroundMy friend Helen has been using the online dating site to find the right date for her. Although dating sites recommend different candidates, she doesn't like everyone. After a summary, she found that there were three types of people who had intercourse:(1) A person who does not like;(2) A person of general charm;(3) A person of great charm;De
people to come together, because its name must be romantic enough, or it can make people fantasize. Imagine that more than 10, 20 years later, those who are married thanks to your website will always remember its name. Who knows, maybe they will open the site again just to find the lost memory.3. Free or paidOnline dating service can be free, partly free or charged. It depends on the target audience you expect. Free websites are most popular with use
K-Nearest neighbor algorithm to improve the pairing effect of dating sites One, theoretical study 1. Read the contentPlease be sure to read the "machine Learning Combat" book 1th and 2nd chapters, this section of the experiment by solving dating site matching effect problem to combatk-近邻算法(k-Nearest Neighbour,KNN)2. Extended ReadingThis section of the recommended
], 15.0*numpy.array (datinglabels), 15.0*Numpy.array (datinglabels))7 #Axis demarcation8Ax.axis ([ -2,25,-0.2,2.0])9 #Axis description (matplotlib configuration Chinese display a little trouble here directly in English well)TenPlt.xlabel ('Percentage of time spent Playing Online games') OnePlt.ylabel ('liters of Ice Cream consumed Per Week') A #Display data analysis diagram -Plt.show ()Get the following data analysis diagram: You can also use the same method to get "frequent flyer m
Flow
When more and more people through the dating site "marriage", few of them know that these sites are not qualified to provide matchmaking services. Reporters yesterday learned that, in order to quickly gain profits, some dating sites frequently over the scope of operation, a few even use special behavior to earn so
is:%f"% (Errorcount/float (numtestvecs)) #输出错误率 - + if __name__=='__main__': ADatingclasstest ()
1 " "2 Enter a person's information and give a forecast of their preferred level3 " "4 defClassifyperson ():5Resultlist = [' not at all','In small doses','In large doses']6Percenttats = Float (raw_input ("percentage of time spend playing video games?"))7Ffmiles = Float (Raw_input("frequent flier miles earned per year?"))8Icecream = Float (raw_input ("liters of ice cream consumed per year?"))9
(1) Collect data: Provide text file(2) Preparing data: Parsing text files with Python(3) Analyzing data: Using Matpltlib to draw two-dimensional diffusion graphs(4) Training algorithm: This step does not apply K-nearest neighbor algorithm(5) test algorithm: Using some of the data provided by Helen as a test sample, the difference between the test sample and the non-test sample is that the test sample is the data that has been sorted, and if the forecast classification is different from the actua
Today read "Machine learning combat" read the use of the K-Near algorithm to improve the matching effect of dating sites, I understand, but see the code inside the data sample set DatingTestSet2.txt a little bit, this sample set where, only gave me a file name, no content ah.Internet Baidu This file name, found a lot of bloggers can download the blog, I am very curious, is also read "machine learning combat
adds 1, and the result of the counter after the execution of the program is divided by the total number of data points is the error rate. Code: print("the total error rate is %f" % (errorCount/float(numTestVecs)))Test:Dating site Prediction functiondef classifyPerson(): resultList = [‘not at all‘,‘in small doses‘,‘in large doses‘] percentTats = float(input("percentage of time spent playing video games?")) ffMiles = f
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.