TutorMe homepage
Subjects
PRICING
COURSES
SIGN IN
Start Free Trial
Abhishek R.
A tutor cum student
Tutor Satisfaction Guarantee
Python Programming
TutorMe
Question:

Write a code to rank social media participants according to their group weight. This code will output k - the nearest neighbor of the queried member. we can change a number of neighbor and the member whose neighbor we want. The output comes in console log as well as graph

Abhishek R.
Answer:

import numpy as np from math import sqrt import warnings import pandas as PD import random import operator import pylab as pl import matplotlib.pyplot as plt from matplotlib import style from collections import Counter style.use('fivethirtyeight') #dataset = { 'k': [[1,2],[2,3],[3,1]], 'r': [[6,5],[7,7],[8,6]]} #new_features=[2,6] dataset2= {'g1':['a','b','e','f'] ,'g2' :['c', 'b', 'e','f','a','g'], 'g3' :['x', 'm', 'z','f','a','g'], 'g4':['r','j','m','c','xx','xz','cb','md','t'] ,'g5' :['c', 'b', 'e','f','a','g','re','xy','mj','yr'], 'g6' :['r', 'l', 'q','s','t','bg','ss','my','jt','c','bd','sc','jy','qp'], 'g7':['a','b','e','f'] ,'g8' :['c', 'b', 'e','f','a','g'], 'g9' :['x', 'm', 'z','f','a','g'], 'g10':['a','b','e','f'] ,'g11' :['c', 'b', 'e','f','a','g'], 'g12' :['x', 'm', 'z','f','a','g'], 'g13':['a','b','e','f'] ,'g14' :['c', 'b', 'e','f','a','g'], 'g15' :['x', 'm', 'z','f','a','g'], 'g16':['a','b','e','f'] ,'g17' :['c', 'b', 'e','f','a','g'], 'g18' :['x', 'm', 'z','f','a','g'], 'g19':['a','b','e','f'] ,'g20' :['c', 'b', 'e','f','a','g'], 'g21' :['x', 'm', 'z','f','a','g'], 'g22':['a','b','e','f'] ,'g23' :['c', 'b', 'e','f','a','g'], 'g24' :['x', 'm', 'z','f','a','g'], 'g25':['a','b','e','f']} vote_weight={'g1':[1,2,3,4], 'g2':[1,4,2,5,6,4],'g3':[1,4,2,5,6,3],'g4':[1,2,3,4,2,5,6,7,2], 'g5':[1,2,4,0.5,6,4,1,3,5,5],'g6':[1,6,4,3,9,0,4,6,8,9,1.2,12,2,1], 'g7':[1,2,3,4], 'g8':[1,4,2,5,6,4],'g9':[1,4,2,5,6,3],'g10':[1,2,3,4], 'g11':[1,4,2,5,6,4],'g12':[1,4,2,5,6,3], 'g13':[1,2,3,4], 'g14':[1,4,2,5,6,4],'g15':[1,4,2,5,6,3], 'g16':[1,2,3,4], 'g17':[1,4,2,5,6,4],'g18':[1,4,2,5,6,3], 'g19':[1,2,3,4], 'g20':[1,4,2,5,6,4],'g21':[1,4,2,5,6,3], 'g22':[1,2,3,4], 'g23':[1,4,2,5,6,4],'g24':[1,4,2,5,6,3], 'g25':[1,2,3,4]} q_user='a' nearest_neightbour =10 def k_nearest_neighbour(data,user,weight,n): occur_group=[] check_usr=user dict_list=[] # list for creating dictionary having duplicate value s=[] # list in sorted order without duplicate value for group in data: for user in data[group]: dict_list.append(user) #dict_list= List(set(first_list)|set(second_list)) #list(set(dict_list)) for i in dict_list: if i not in s: s.append(i) s.sort() #sorting the list for user in s: print(user) d = dict.fromkeys(s, 0) # creating dictionary with initial value of 0 for i in d: print (i, d[i]) for group in data: if check_usr in data[group]: print([group]) occur_group.append(group) #list(set(occur_group).intersection(data)) '''for group in occur_group: for users in weight[occur_group]: sum(occur_group) ''' #new=[] for group in occur_group: for group1 in weight: if group == group1: for user, value in zip(data[group], weight[group1]): print(user,value) d[user] +=value #updating value in dictionary '''for user in data[group]: new.append(user) print(user) for value in weight[group1]: print(value)''' sorted_d = sorted(d.items(), key=operator.itemgetter(1),reverse=True) print(*occur_group, sep='\n') print(sorted_d) print(sorted_d[:n]) user_list, value_list= map(list, zip(*sorted_d)) req_plot_user=user_list[:n] req_plot_value=value_list[:n] print(user_list) print(value_list) pl.figure(1) x = range(n) pl.xticks(x, req_plot_user) pl.plot(x,req_plot_value,"g") pl.show()

HTML Programming
TutorMe
Question:

Design a website

Abhishek R.
Answer:

I have designed a website as project and it is hosted at URL: www.ekkpahel.com/project

English
TutorMe
Question:

Write a short essay on something without plagiarism

Abhishek R.
Answer:

WHY EDUCATION IS IMPORTANT 7.6 Billion people from different countries speaking different languages, but we understand and respect each other because of single precious thing "Education". Education Creates a prime difference between human being and other creatures. At an early stage of life, our parents and relatives teach us manners and etiquettes. Then we go ahead further in life by learning from institutions or learning on our own. The sack of learning keeps on filling until our death. Education provides us knowledge of everything around us. It helps us to know our basic rights and apprise us methods to claim if violated. The knowledge we got from education makes us more creative and logical which brings forth new inventions. It also helps people to earn for their livelihood. Educated person fit anywhere in society and can tackle any challenges which life throws in their way. People rubbing their heads on the walls of education become confident enough that they are hard to duped by anyone because they know the fact beneath the story. Education helps us to think reasonably and take independent decisions in life. The education comes from everywhere be its past, present or future. For example, the mistakes done by our ancestors are analyzed and worked upon to have a better tomorrow. Every day scientist and inventors are coming up with new technology through the knowledge they got from their education. The huge problem of climate change, population growth, chronic diseases can be controlled with education. We have seen in past that cure of diseases like polio, smallpox, and tuberculosis was not available but after recent advancement in medical sciences, these diseases can be cured. So, a person can live a new life because another person positively utilized the power of education. Although, we can keep on boasting about the positive impact of education at the same we should not neglect the negative one. People are using knowledge from education to create arms, plant bombs, robbing banks, stealing personal data and many more. So, at the same time, we need to be educated to apply our knowledge make this world better not the worse. Education should not be confused with the tool to earn livelihood it's the way to unleash genius inside everyone. We should create opportunity so that everyone is educated and realize their dream. As told by Mark Zuckerberg "When people realize their dream they not only make themselves happy they make this world a better place to live in”.

Send a message explaining your
needs and Abhishek will reply soon.
Contact Abhishek
Ready now? Request a lesson.
Start Session
FAQs
What is a lesson?
A lesson is virtual lesson space on our platform where you and a tutor can communicate. You'll have the option to communicate using video/audio as well as text chat. You can also upload documents, edit papers in real time and use our cutting-edge virtual whiteboard.
How do I begin a lesson?
If the tutor is currently online, you can click the "Start Session" button above. If they are offline, you can always send them a message to schedule a lesson.
Who are TutorMe tutors?
Many of our tutors are current college students or recent graduates of top-tier universities like MIT, Harvard and USC. TutorMe has thousands of top-quality tutors available to work with you.