// GET
        public ActionResult View(string userId)
        {
            var castedUserId = int.Parse(userId);
            var payload      = GetPayload();
            var users        = GetUsers(payload);
            var articles     = GetArticles(payload);

            // Throw not found exception if user is not listed
            if (!users.ContainsKey(castedUserId))
            {
                throw new HttpException(404, "Not found");
            }

            var user = users[castedUserId];

            ViewBag.UserId   = castedUserId;
            ViewBag.Users    = users;
            ViewBag.User     = user;
            ViewBag.Articles = articles;

            const float threshold      = 0.35f;
            var         neighborHelper = new NearestNeighbors(users.Values.ToList(), user, articles);

            ViewBag.Neighbors = new Dictionary <string, IEnumerable <Tuple <User, float> > >
            {
                { "pearson", neighborHelper.ListSimilarities(new Pearson(), threshold) },
                { "cosine", neighborHelper.ListSimilarities(new Cosine(), threshold) },
                { "euclidean", neighborHelper.ListSimilarities(new Euclidean(), threshold) }
            };

            return(View());
        }
예제 #2
0
 public static (NDArray, int, int) MeanShiftSingleSeed(NDArray my_mean, NDArray X, NearestNeighbors nbrs, int max_iter)
 {
     throw new NotImplementedException();
 }
예제 #3
0
 internal static void SetReachDist(NDArray core_distances_, NDArray reachability_, NDArray predecessor_,
                                   int point_index, bool processed, NDArray X, NearestNeighbors nbrs, string metric, FuncArgs metric_params,
                                   int p, float max_eps)
 {
     throw new NotImplementedException();
 }
예제 #4
0
 internal static NDArray ComputeCoreDistances(NDArray X, NearestNeighbors neighbors, int min_samples, int working_memory)
 {
     throw new NotImplementedException();
 }