comp10001-project01/old/part5.py

35 lines
1.9 KiB
Python
Raw Normal View History

# Title: Project 1 - Social Network Attribute Prediction
# Author: Rory Healy
# Date created - 18th April 2019
def friendship_closeness():
'''Assigns a "friendship-closeness" value, from 0 to 1, based on the number
of degrees of seperation between people. The further the seperation, the
closer this value is to 0. Takes a dictionary of sets of friends
"bestie_dict" and returns a dictionary of sets of friends with their
"friendship-closeness" value.'''
def prioritise_friendships():
'''Make the predictions prioritise those from the people with the highest
"friendship-closeness" value. Takes a user, stored as the string
"unknown_user", and returns a list of sets of other people in order of
highest to lowest closeness (e.g. degree-one friends are in the first set,
degree-two people are in the second set, etc.).'''
def friendly_prediction(unknown_user, features, bestie_dict, feat_dict):
'''Takes a user, stored as the string "unknown_user", features of the user
that are used to predict attributes, stored as a set "features", a
dictionary of sets of friends "bestie_dict", and a dictionary containing
the known attributes for each user "feat_dict". Returns a dictionary of
features with a predicted list of values for each feature.'''
# For the first given example, the predicted favourite author comes from
# Kim, while the predicted university comes from both Sandy and Alex. As
# Sandy and Alex are both degree-two friends, preference can be given to
# neither without further information. This is a main limitation for the
# 'friendship-closeness' value being used to make a prediction, as the
# unknown user may be closer to one degree-two friends than another. I
# know that this isn't necessarily relevent to creating this program, just
# something that I was thinking about while fixing up the other parts of
# this project.