Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

implement standard inference #694

Open
mastercyb opened this issue Nov 5, 2023 · 4 comments
Open

implement standard inference #694

mastercyb opened this issue Nov 5, 2023 · 4 comments
Labels
Epic Something amazing and big Priority: High

Comments

@mastercyb
Copy link
Member

mastercyb commented Nov 5, 2023

We discussed for a while one property of the ranking mechanism which rise huge concerns into the answering capabilities of cyber: lets call it true-false problem

true-false problem

  • let us imagine that true particle have cyberank 10, and false particle have cyberank 9
  • the environment allow to link any particle with any
  • that means that for any questions which cyberlinked to true and false the winning answer will always be true
  • of course such behavior does not feels like something superintelligent
  • we always emphasize that cyberank is a core ranking factor, but not the only one which is possible on top the cyber architecture
  • in order to solve true-false problem we have to compute weights of links in a context

in this post i introduce an algo i will call standard inference

  • does not introduce additional complexity
  • requires zero additional information
  • follow occam razor principle, that is it is as dumb and simple as possible

standard inference

  • get all particles cyberlinked with asking particle sorted by rank
  • for each particle get all cyberlinks
    • for each cyberlink get address
      • for each address
        • get [[V]] balance
        • get number of cyberlinks
        • compute average [[V]] per cyberlink
    • sum (average V) votes for every particle
  • multiplay rank of each particle by sum (average V)

cyber project without consensus around standard inference on top of cybergraph which solves true false problem seems very blurry to me

@mastercyb mastercyb added the Epic Something amazing and big label Nov 5, 2023
@mastercyb mastercyb transferred this issue from cybercongress/cyb-ts Nov 5, 2023
@mastercyb mastercyb moved this to In Progress in build town Dec 15, 2023
@SaveTheAles
Copy link
Member

@Snedashkovsky

Check the query, there are probably some ways to improve or correct it

WITH filtered_particles AS (
	SELECT 
		multiIf (
			particleFrom != 'QmZPGMtHBaJwURxUrfXdDswhWZ9zL1mPvABcdxSf1dJz1R', particleFrom,
			particleTo != 'QmZPGMtHBaJwURxUrfXdDswhWZ9zL1mPvABcdxSf1dJz1R', particleTo,
			''
		) AS particle FROM spacebox.cyberlinks
	WHERE particleFrom = 'QmZPGMtHBaJwURxUrfXdDswhWZ9zL1mPvABcdxSf1dJz1R' OR particleTo = 'QmZPGMtHBaJwURxUrfXdDswhWZ9zL1mPvABcdxSf1dJz1R'
), linked_cyberlinks AS (
	SELECT 
		particle,
		particleFrom,
		particleTo,
		neuron
	FROM filtered_particles
	LEFT JOIN 
	    spacebox.cyberlinks AS c
	ON 
	    filtered_particles.particle = c.particleFrom OR filtered_particles.particle = c.particleTo
), account_debs AS (
	SELECT * FROM spacebox.debs_and_creds
), sum_with_filter as (
	SELECT 
			address,
			height,
			amount,
			sum(amount) over (partition by address, denom order by height) as saldo, 
			denom
	FROM
		account_debs
	WHERE denom = 'millivolt'
), ranked_saldo AS (
	SELECT
		address,
		denom,
		saldo,
		height,
		ROW_NUMBER() OVER (PARTITION BY address, denom
	ORDER BY
		height DESC) AS rn
	FROM sum_with_filter
), filtered_saldo AS (
	SELECT
		address,
		height,
		saldo,
		denom
	FROM
		ranked_saldo
	WHERE
		rn = 1 and saldo != 0
), joined_balances AS (
	SELECT 
		particle,
		particleFrom,
		particleTo,
		neuron,
		saldo as balance
	FROM linked_cyberlinks
	LEFT JOIN filtered_saldo ON linked_cyberlinks.neuron = filtered_saldo.address
), average_vote AS (
	SELECT 
		particle,
		particleFrom,
		particleTo,
		neuron,
		balance / 1000 as balance,
		links,
		balance / links as avg_vote
	FROM joined_balances
	LEFT JOIN (SELECT neuron, count(neuron) as links FROM spacebox.cyberlinks GROUP by neuron) as t ON joined_balances.neuron = t.neuron
), united_particles AS (
	SELECT particleFrom as particle, avg_vote
	FROM average_vote
	UNION ALL
	SELECT particleTo as particle, avg_vote
	FROM average_vote
) 
SELECT particle, sum(avg_vote) as sum_avg_vote 
FROM united_particles
GROUP BY particle
ORDER BY sum_avg_vote DESC

cyberlinks and debs_and_creds tables are required

@Snedashkovsky
Copy link
Member

@SaveTheAles LGTM

@mastercyb
Copy link
Member Author

what is LGTM?

@mastercyb mastercyb moved this to Ready for dev in 🤖 cyb Jul 22, 2024
@mastercyb mastercyb moved this from Ready for dev to 🏗 In progress in 🤖 cyb Aug 2, 2024
@happylolonly
Copy link
Member

API not deployed for now

@happylolonly happylolonly moved this from Ready for dev to blocked in 🤖 cyb Aug 15, 2024
@happylolonly happylolonly removed their assignment Sep 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Epic Something amazing and big Priority: High
Projects
Status: 🏗 In progress
Status: In Progress
Development

No branches or pull requests

7 participants