Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8301825
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T17:08:18+00:00 2026-06-08T17:08:18+00:00

I have a model as such (non-Hadoop) : DataModel data = new FileDataModel(new File(file.csv));

  • 0

I have a model as such (non-Hadoop) :

DataModel data = new FileDataModel(new File("file.csv"));
UserSimilarity userSimilarity = new PearsonCorrelationSimilarity(dataModel);
userSimilarity.setPreferenceInferrer(new AveragingPreferenceInferrer(data));
UserNeighborhood userNeighborhood = new NearestNUserNeighborhood(1, userSimilarity, data);

userSimilarity is not normalized between [0,100] for instance, so if I want to display it to end users, I use the following solution :

long maxSim = userSimilarity.userSimilarity(userId1, userNeighborhood.getUserNeighborhood(userId1)[0]);
long finalSimilarity = Math.min(100, Math.max((int) Math.ceil(100 * userSimilarity.userSimilarity(userId1, userId2) / maxSim), 0))

I observed performance issues with this (various seconds for each user), is there another possibility, or quickest way to have min(similarity) = 0 and max(similarity) = 100 for each given user?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T17:08:21+00:00Added an answer on June 8, 2026 at 5:08 pm

    Your performance problem has nothing to do with your normalization, and everything to do with the rest fo the calculation.

    I would not use AveragingPreferenceInferrer by the way. It slows things down and rarely helps. You may also find it faster to simply loop over all users and compute similarity to find the most similar one. Computing a neighborhood of 1 is about the same but a little closer.

    Pearson correlation is in [-1,1]. If you want it in a range of [0,100], simply use 50*(1+correlation).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Assuming that I have such model COLORS= ( ('R', 'Red'), ('B', 'Yellow'), ('G', 'White'),
I have a such model named Foo: class Foo(models.Model): name = models.CharField() entry =
I have a model of events that has various information such as date, location,
I have a function in my Comic Model as such: <?php class Comic extends
Suppose I have a simple model, such as Record: @Model public class Record {
WPF and Silverlight have a data binding model whereby I can provide a Binding
I know that ASP.NET controls such as the button have the postback event model.
I have two devise models: User and Member As such, I'm specifying authentication keys
Given models User and Comments being populated such that a user may have many
I have Messages and User models with corresponding tables. The Messages table has such

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.