내가해야 할 일은 두 고객의 평점 사이의 내적 거리를 계산하는 것입니다. 고객의 등급은 해시 맵에 기록됩니다.자바에서 dotproduct 거리 계산
private HashMap<String,int[]> ratingmap;
해시 맵의 핵심은 고객의 이름이며, 해당 고객의 평가 (책의 자신의 등급은) 함께있는 관련
내가 이것을 어떻게 할 것인가? 여기
/**
* calculate dot product distance between the ratings of two customers
* @param name1 String name of customer
* @param name2 String name of customer
* @return int distance or ILLEGAL_INPUT if name1 or name2 are not customers
*/
public int distance(String name1, String name2)
{
return 0; //replace with code
}
그리고
는RatingsAnalysis
에
RatingsAnalysis
클래스 아마도
//collection of rated book titles
private BookList books;
//collection of customers and their ratings
private RatingsMap ratings;
//use a list of customer names from the ratings map for looping through the map
private ArrayList<String> customernames;
하세요 이 문맥에서 "내적 거리"를 정의하십시오. –
내적 거리는 두 고객의 등급이 '밀접하게'어떻게 관련되어 있는지를 나타냅니다. 각 고객이 책에 등급을 매기는 것과 같이 내가 볼 수있는 것은 등급이 얼마나 가까운지를 묻는 것입니다. 즉 – Danial
이 문맥에 어떤 계산이 포함되는지는 분명하지 않습니다. 질문을 편집하여 수행 할 계산의 예를 제공하십시오. –