damus-io / damus

iOS nostr client
GNU General Public License v3.0
1.96k stars 288 forks source link

Algorithms #1302

Open alltheseas opened 1 year ago

alltheseas commented 1 year ago

what is it Algorithm capability will enable Damus users to opt-in to various algorithms as a complement to the chronological timeline.

This could enable "trending" posts, "trending" profiles etc

implementation @jb55 was exploring script? language capability

https://damus.io/note1ejhkppvw74f966fxw4srhvsd3npyjjpm9pq65p6qlv06xu2eu2hqklcwv4

design exploration @robagreda what might a "algo marketplace" look like?

requirements:

-damus user can always opt-in, or opt-out -there are no mandatory algorithms (see twitter) -algorithms are a marketplace -algos can be developed by third party devs -algos can be free, or paid / there is a way to zap algo devs -damus algos must have easy to find name, description, author -damus must clearly display if algo is installed -damus must clearly display if algo view is on -damus must clearly have a way to "install", and "uninstall"

questions:

is there "install" button? is there a "uninstall" button (i.e. "algo store" can service as a place to manage all algos) where does the installed algo take place? can there be more than one algo installed? how might user swap between algos; does each algo have a separate view?

crazy experiment areas can algos be combined? can there be a way to zap (i.e. optionally tip) algo authors

GBKS commented 1 year ago

That's a fun exploration. It might be best to start with thinking about what people might want to use algos for, and then derive the display from there. Always good to work with realistic content and scenarios. Did someone already explore that in depth? For example, is search also an algo?

Generally, the idea is that there are different views into all the activity. I like how Twitter has the row of tabs at the top when you set up multiple lists. Allows you to quickly switch between them. I also make heavy use of algo user options like muting/blocking words/people/hashtags. Twitter also has a bunch of other search options that could be considered. For example, when searching for bitcoin content, it's often helpful to use -filter:links to remove spam.

It can get pretty complex technically, but I do wonder if there aren't a handful of use cases that cover 98% of all needs.

alltheseas commented 1 year ago

Generally, the idea is that there are different views into all the activity. I like how Twitter has the row of tabs at the top when you set up multiple lists. Allows you to quickly switch between them.

Agree

I also make heavy use of algo user options like muting/blocking words/people/hashtags

These are not algos, but user created lists. Unless your idea is to automate this, and have algos make these decisions on behalf of the user. This a twitter, fb very dark, not opt-in, pattern.

Twitter also has a bunch of other search options that could be considered. For example, when searching for bitcoin content, it's often helpful to use -filter:links to remove spam.

The above is an advanced search description. We have this on roadmap, and have not prioritized yet. https://github.com/damus-io/damus/issues/493 https://github.com/damus-io/damus/issues/1075

It might be best to start with thinking about what people might want to use algos for Currently the only option of timeline, and universe views is chronological. An algo could find notes in an order other than chronological.

Top zapped replies is an example sorting. https://github.com/damus-io/damus/issues/1116 Most zapped notes view. https://github.com/damus-io/damus/issues/686

We don't need algo marketplace capability for the above two examples. However, if we are to provide "algo marketplace" capability there can be third party algo providers that experiment and provide novel algorithms for exploration. This is something that twtr, and fb are incentivized not to do, as they keep their users in a perpetual state of doomscrolling amid sale of user data, and ads bombardment.

GBKS commented 1 year ago

These are not algos, but user created lists. Unless your idea is to automate this, and have algos make these decisions on behalf of the user. This a twitter, fb very dark, not opt-in, pattern.

Yes, these are put together by the user, but shouldn't an algo also consider them? Or does the algo create a feed and then the client applies the mute/block list filtering afterwards on the results? Whether I see my chronological timeline, most zapped content or do a search, I may still just not ever see certain terms or content from certain people.

In my mind, these things are all related. I create a "view into the stream of information", which involves an logic part (the algo) as well as user options (search term and parameters like filtering links, as well as the mute/block list) that the logic part works with (variables essentially).

alltheseas commented 1 year ago

but shouldn't an algo also consider them?

It depends on the algo that is "installed" by the user.

In my mind, these things are all related. I create a "view into the stream of information", which involves an logic part (the algo) as well as user options (search term and parameters like filtering links, as well as the mute/block list) that the logic part works with (variables essentially).

Agree

alltheseas commented 1 year ago

https://github.com/damus-io/damus/pull/1246

alltheseas commented 8 months ago

User defined algos requirements & suggestions:

  1. Algos must be opt-in ("user enabled")
  2. Algos must be known, visible, and configurable
  3. Keep "chronological" algo as an option
  4. Add "trending" option
  5. Add open API/store for build your own. "api/store: don’t be the gatekeeper for algorithms. allow others to publish algorithms and users to use them."
  6. Ability to zap algorithm creators
  7. Media feed image

trending: some kind of damus secret-sauce algorithm. show me cool stuff based on past zaps, likes, follows, etc.

api/store: don’t be the gatekeeper for algorithms. allow others to publish algorithms and users to use them. provide some kind of api for making that possible

in practice the api could be some nostr event that holds some nostrscript or w/e mechanism damus uses to define algorithms -Ben

https://damus.io/note162ul7rne3qhrksk8wlf76ar4stm9k3jv4xwtcc34ga26kdwtljcqqllevf

Tangential: user lists https://github.com/damus-io/damus/issues/531

alltheseas commented 7 months ago

https://damus.io/note1kpm4dhdtl3lhlmcepjgleycmrunlydjfvem5zdycmea73g8uhpmqr36z44

Algo implementation and UI via bluesky for web. UI is not normie friendly.

alltheseas commented 7 months ago

User feedback https://damus.io/note1tkn46rxjd73ef27cehgnqyhv0gy52ue8y3tjwkzntqnaqdln5xvs96w5dq

jb55 commented 1 month ago

@GBKS wrote:

Twitter also has a bunch of other search options that could be considered. For example, when searching for bitcoin content, it's often helpful to use -filter:links to remove spam.

I'm putting together a flexible way of building any kind of algorithm, filtering links would be very easy with nostrscript + nostrdb:

-- note blocks are blocks of parsed contents
for block in nostr_note_blocks(note) {
  if block.type == url {
      return false
  }
}
return true

this could be assemblyscript or a custom wasm-targetted language that I'm calling nostrscripts. These filters run alongside nostrdb queries, so that are super efficient. I am also planning on creating reducers for more than just filtering.

Full plan here: