[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vip /vp / vr / w / wg / wsg / wsr / x / y ] [Search | Home]
4Archive logo
Hi /sci/, I need some help with choosing...
If images are not shown try to refresh the page. If you like this website, please disable any AdBlock software!

You are currently reading a thread in /sci/ - Science & Math

Thread replies: 35
Thread images: 4
File: 1445225535040.png (44 KB, 753x772) Image search: [iqdb] [SauceNao] [Google]
1445225535040.png
44 KB, 753x772
Hi /sci/, I need some help with choosing a sorting algorithm for a website I'm coding. /g/wdg/ is useless and keeps calling me an autist when I point out that their suggestions are not even related to what I was asking for (for example, one poo in the loo linked me to a tutorial on how to sort an array numerically, which isn't what I was asking for at all).

So here's what I need:
I want to take in how old a given post on my website is and what rating it has, and then output a natural number which ranks the said post. The higher the rank, the higher in the post list it will appear.
This function should create an optimal balance between freshness and quality of content for the users.
What do you suggest, /sci/?
>>
Hot damn CS tards are stupid.
>>
>>7790528
I'm simply looking for a suggestion. I could easily write any function of that sort, but I'm looking for an optimal one.
>>
>>7790513
>sorting shit yourself

This is what you do. In your database at a column called 'Rating'.

Then, make an algorithm that by using the date of the post and the likes or whatever it has produces the natural number that ranks the post.

Then, everytime someone likes a post have it run that algorithm to recalculate immediately.

Then, when someone looks up your website simply do this:

SELECT * FROM Posts ORDER BY Rating ASC

>inb4 I'm not using SQL for my database
Then you fucked up. Better start loading up the helium tank.
>>
Nobody help this spastic retard

>>>/g/52471300
>>>/g/52471709
>>
>>7790555
topkek then I explained him what he already 'knew'.

Real talk here OP. You can ask whatever you want and people will help you with the trivial SQL queries and what not.

BUT DID YOU FUCKING EXPECT SOMEONE TO DO YOUR FUCKING WORK AND CODE YOU THE ALGORITHM?

Are you retarded? Have some sense of shame, OP. It is your fucking website and this would need heavy consideration. How radical do you want it to be? How impactful do you want the date to be? How impactful should every like be? Should be impact of likes diminish as the number of likes grow. Like, the first 'LIKE' really bumps it up but after like 5000 likes then it doesn't have that much impact.

Think for your fucking self, OP.
>>
>>7790561

Literally this

>reddit had entire team spend months trying to improve their algorithm and still failed
>Dipshit asks to be given an algorithm in a web dev thread and goes autistic when he doesn't have a printed copy of the algorithm and documentation of it written in latex hand delivered to him

>why wont YOU IDIOTS just give me the answer so I can spend three minutes coding it

fuck off OP
>>
>>7790561
>BUT DID YOU FUCKING EXPECT SOMEONE TO DO YOUR FUCKING WORK AND CODE YOU THE ALGORITHM?

This. OP can get fucked.
>>
>>7790528
He's not CS. If he was he'd know the answer.
>>
>>7790567
Actually, your post reminded me that there is a pretty good solution for this. I highly doubt OP is capable of understanding or using it though.

http://www.evanmiller.org/how-not-to-sort-by-average-rating.html
>>
>that image
i feel this feel strongly
>>
>>7790567
>implying the reddit devs are competent
if they knew what they were doing in the first place they wouldnt have made their smart-ranking system
>>
>>7790656
I don't browse rebbit but my understanding is that they used to have a shit algorithm and then read this article >>7790652 and implemented a less shit algorithm (albeit probably in a shit way since it's rebbit).
>>
>>7790645
>CS
>Knowing the answer
>To ANYTHING

Oh don't make me laugh.
>>
Would solve it by weight for rating, weight for date and introduce importance weight modifiers.
>>
>>7790513
You can use literally any bubble algorithm then use a reference table to tie the score in an ordered list to the post.

or you can follow roody poos advice and just use array functionality which would be the faster.

Numpy has the arange function which does exactly what you're trying to do,
>>
Came in here hoping to read a debate weighing the merits of various number sorting algorithms. Was dissapoint.
>>
>>7790550
Your retarderded
>>
>>7790758
Just shut your mouth if you don't know what you're talkijg about
>>
>>7790567
>reddit had entire team spend months trying to improve their algorithm and still failed
>reddit

Proving ... what?
>>
>>7790513
>What do you suggest, /sci/?
I would suggest
Score = (aggregated user rating) x exp (-t/T)

where t is age and T is the decay rate. T is a tuneable parameter and you can start by using a T that reduces the Score to half the value after one week.

Also (aggregated user score) could be tuned so that late additions receive a lower score to prevent bumping. Again you could use decay rates:
(aggregated user score) = (previous aggrecated user score ) += ((new score) x exp ((time since previous ranking) / R))

Tune R so that a score gets half the value when someone bumps one week after previous ranking.

Use of decay rates are commonly used in mathematical modelling in physics, basic knowledge really.
>>
>>7790652
This is what I was going to post too. +rep for you.
>>
>>7790513
is it a porn site
>>
>>7790652
>pretty good solution
How did freshness, as requested by OP, come into the equations you liked to?

>>7794242
>+rep for you
The irony.
>>
File: 1407118051513.png (233 KB, 393x391) Image search: [iqdb] [SauceNao] [Google]
1407118051513.png
233 KB, 393x391
>>7790528
>Blame CS just because is the sexiest major nowadays.
>Joel Spolsky, one of the creators of stackoverflow, has a BS summa cum laude in Computer Science.

KEEP HATING YOU BROKE NIGGER.
>>
File: Applefags BTFO.webm (580 KB, 1280x720) Image search: [iqdb] [SauceNao] [Google]
Applefags BTFO.webm
580 KB, 1280x720
>this thread
>>
>>7794329
>[Person who works in CS], one of the creators of [Software/CS company] has a [CS degree]

Oh wow. Such deep insight right here! I knew that if I looked deep enough I would find the good CS majors like this one. Just from that post I can calculate an IQ 300.

>A CS graduate has a job in CS-related field
>SEE HOW SUCCESFUL WE ARE! HAHAH!
>>
>>7792577
Hello friend you must be new here.
>>
>>7790513
sleep sort it.
>>
>>7790719
How much of your life have you wasted baselessly insulting a field of study on 4chan?

Life is short. Don't waste the time you have by being an idiot.

By the way, CS says "you're welcome" for this website.
>>
>>7790652
>confidence interval
>Given the ratings I have, there is a 95% chance that the "real" fraction of positive ratings is at least what?
>>
>>7790513
Having people rate individual posts instead of threads is going to cause people to upvote stuff they agree with (good for a SO clone, bad for a discussion forum).

As for a formula, you should do a little trial and error to see what works best.
>>
File: 1376939977623.png (24 KB, 625x626) Image search: [iqdb] [SauceNao] [Google]
1376939977623.png
24 KB, 625x626
>>7794895

Please, we all know cs majors are hacks
>>
Evidently there are two approaches here, either the physics one as in >>7794236 by modelling,
or the CS one which as commented in >>7794269
only addresses half the problem and studiously ignores the OP real problem. Why discuss freshness when you can go all out on a tiny algorithm for ranking ... alone?

If CS wants to demonstrate their superiority they should at the very least come up with a solution rather than alleging it is trivial.
>>
>>7795407
>If CS wants to demonstrate their superiority they should at the very least come up with a solution rather than alleging it is trivial.

But for CS people, it is trivial. CS people have been trained that the solution is simply
>import algorithm:

>Daily reminder that not once do CS majors have to do any kind of low level programming
>Daily reminder that CS courses are now teaching Python, as slow and as separated from the core as you can get while not being a javascript kiddy.
>Daily reminder that when given homework, CS students will unironically ask their professors if they are allowed to import a library that basically does it all for them
>Daily reminder that 9 out of 10 times the professor will tell them yes, because he doesn't want 90% of the class to fail because they can't even declare a variable
>Daily reminder that if you do crystal meth, at least you are not destroying your life quite as badly as the computer science student next to you.

Computer science - not even once.
Thread replies: 35
Thread images: 4
Thread DB ID: 436975



[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vip /vp / vr / w / wg / wsg / wsr / x / y] [Search | Home]

[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vip /vp / vr / w / wg / wsg / wsr / x / y] [Search | Home]

All trademarks and copyrights on this page are owned by their respective parties. Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
This is a 4chan archive - all of the shown content originated from that site. This means that 4Archive shows their content, archived. If you need information for a Poster - contact them.
If a post contains personal/copyrighted/illegal content, then use the post's [Report] link! If a post is not removed within 24h contact me at [email protected] with the post's information.