Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
1.6 kB
15
Indexable

// user info

class User{
    String id;
    UserData userData;

    UserData getUserDetails();
}

class UserData{
    string id;
    Location location;
    List<Interests> interests;
    List<User> friends;
}

class Location{
    string lat,
    string long;
}

enum Interests{
    DANCING, SINGING, MUSIC, READING
}

// Reccomendation Interface

class Reco{
    MLAPI mlAPI;

    List<Clusters> generateReccomentationClusters(ModelType modelType){
        //strategy pattern
        switch(modelType){
            case ModelType.LOC:
                mlAPI = new LocationBasedMLAPI();
                break;
            case ModelType.INTEREST:
                mlAPI = new InterestBasedMLAPI();
                break;
        }

        return mlAPI.getClusters();
        return clustersToUsers(clusters);
    }

    List<User> getRecoForOneUser(ReccomendationRequest reccomendationRequest);

    Map<User, List<User>> getRecoBulk(BulkReccomendationRequest bulkReccomendationRequest);

}

eum ModelType{
    LOC, INTEREST
}

class ReccomendationRequest{
    string userId;
    string ModelType;
    string requestId;
}

class ReccomendationRequest{
    List<String> userId;
    string ModelType;
    string requestId;
}

// ml interface


//abstraction
interface MLAPI{
    List<Cluster> getClusters(Datastore datastore);
}

class LocationBasedMLAPI implements MLAPI{
    List<Cluster> getClusters(Datastore datastore);
}

class InterestBasedMLAPI implements MLAPI{
    List<Cluster> getClusters(Datastore datastore);
}

class DataStore{
    List<User> allUsers;
}