Skip to content

Commit f640d6b

Browse files
committed
Merge remote-tracking branch 'upstream/master'
2 parents e68ffed + e570128 commit f640d6b

File tree

22 files changed

+40
-26
lines changed

22 files changed

+40
-26
lines changed

README.md

+10
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,16 @@ Video 1: <a href="doc/musicdao/thesis2.mp4">Load example.</a> This uses a defaul
133133

134134
Video 2: <a href="doc/musicdao/thesis3.mp4">Share track.</a> Note: as a fresh magnet link is generated in this video, there is only 1 peer. For this reason it will be difficult to obtain the metadata of the magnet link (cold start issue, write about this in thesis) so the video stops there.
135135

136+
### Federated, privacy-preserving music recommendations via gossiping
137+
138+
This is a demonstration of machine learning which relies exclusively on edge computing. Music recommendation inside the MusicDAO is used to demonstrate gossip-based machine learning.
139+
140+
Every time a user opens MusicDAO, they are asked to reload the page in order to get recommendations. The recommendation engine yields two recommendations made by two different models: a musical feature-based model and a collaborative filtering model. The collaborative filtering model is based on federated matrix factorization as introduced in [this paper](https://dmle.iais.fraunhofer.de/papers/hegedus2019decentralized.pdf). The feature-based models are from this [paper](https://arxiv.org/pdf/1109.1396.pdf), called Adaline and Pegasos. These models are trained on audio features extracted from music files with the [Essentia library](https://essentia.upf.edu/).
141+
<img src="gossipML/docs/imgs/overview.png" height="400px">
142+
143+
The feature-based models are gossiped along random walks through the network. At each peer they are merged and re-trained on peer's local data. The matrix factorization model seeks to learn a factorization of the user-song matrix. This means that one of the two factors contains only information on how users generally rate each song. This matrix can then be gossiped around the network while a user's personal vector as well as their listening history are kept private.
144+
- [More about federated machine learning using gossiping for music recommendations](gossipML/README.md)
145+
136146
### Do you want to add your own app?
137147

138148
- [Adding your own app to the TrustChain Super App](doc/AppTutorial.md)

app/build.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ dependencies {
149149
implementation ('net.java.dev.jna:jna:5.5.0@aar')
150150
implementation('com.github.tony19:logback-android:2.0.0')
151151

152-
implementation 'com.mattskala:itemadapter:0.4'
152+
implementation 'com.github.MattSkala:recyclerview-itemadapter:0.4'
153153

154154
// Testing
155155
testImplementation 'junit:junit:4.12'

build.gradle

+3-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@ buildscript {
1313
repositories {
1414
google()
1515
jcenter()
16+
mavenCentral()
1617
maven { url "https://plugins.gradle.org/m2/" }
18+
maven { url 'https://jitpack.io' }
1719
}
1820
dependencies {
1921
classpath 'com.android.tools.build:gradle:4.1.3'
@@ -36,8 +38,7 @@ allprojects {
3638
repositories {
3739
google()
3840
jcenter()
39-
maven { url "https://dl.bintray.com/mattskala/maven" }
40-
maven { url "https://dl.bintray.com/terl/lazysodium-maven" }
41+
mavenCentral()
4142
maven { url 'https://jitpack.io' }
4243
}
4344

common/build.gradle

+2-2
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ dependencies {
9898
implementation 'io.github.microutils:kotlin-logging:1.7.7'
9999
//implementation 'com.github.tony19:logback-android:2.0.0'
100100

101-
implementation 'com.mattskala:itemadapter:0.4'
101+
implementation 'com.github.MattSkala:recyclerview-itemadapter:0.4'
102102

103103
// BitTorrent
104104
api files('libs/jlibtorrent-1.2.10.0.jar')
@@ -115,7 +115,7 @@ dependencies {
115115
testImplementation "io.mockk:mockk:1.9.3"
116116
testImplementation 'org.json:json:20190722'
117117
testImplementation "com.squareup.sqldelight:sqlite-driver:$sqldelight_version"
118-
testImplementation "com.goterl.lazycode:lazysodium-java:4.3.2"
118+
testImplementation "com.goterl:lazysodium-java:5.0.1"
119119
annotationProcessor 'androidx.room:room-compiler:2.2.5'
120120
}
121121

common/src/test/java/nl/tudelft/trustchain/common/util/VotingHelperTest.kt

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package nl.tudelft.trustchain.common.util
22

3-
import com.goterl.lazycode.lazysodium.LazySodiumJava
4-
import com.goterl.lazycode.lazysodium.SodiumJava
3+
import com.goterl.lazysodium.LazySodiumJava
4+
import com.goterl.lazysodium.SodiumJava
55
import com.squareup.sqldelight.db.SqlDriver
66
import com.squareup.sqldelight.sqlite.driver.JdbcSqliteDriver
77
import io.mockk.mockk

currencyii/build.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ dependencies {
9191
// Logging
9292
implementation 'io.github.microutils:kotlin-logging:1.7.7'
9393

94-
implementation 'com.mattskala:itemadapter:0.4'
94+
implementation 'com.github.MattSkala:recyclerview-itemadapter:0.4'
9595

9696
// Testing
9797
implementation 'androidx.legacy:legacy-support-v4:1.0.0'

debug/build.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ dependencies {
6666
implementation 'io.github.microutils:kotlin-logging:1.7.7'
6767
implementation 'com.github.tony19:logback-android:2.0.0'
6868

69-
implementation 'com.mattskala:itemadapter:0.4'
69+
implementation 'com.github.MattSkala:recyclerview-itemadapter:0.4'
7070

7171
// Testing
7272
testImplementation 'junit:junit:4.12'

distributedai/build.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ dependencies {
6666
implementation 'io.github.microutils:kotlin-logging:1.7.7'
6767
implementation 'com.github.tony19:logback-android:2.0.0'
6868

69-
implementation 'com.mattskala:itemadapter:0.4'
69+
implementation 'com.github.MattSkala:recyclerview-itemadapter:0.4'
7070

7171

7272
implementation "com.androidplot:androidplot-core:1.5.7"

eurotoken/build.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ dependencies {
6464
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:$lifecycle_version"
6565
implementation "androidx.lifecycle:lifecycle-livedata-ktx:$lifecycle_version"
6666

67-
implementation 'com.mattskala:itemadapter:0.4'
67+
implementation 'com.github.MattSkala:recyclerview-itemadapter:0.4'
6868

6969
// Material
7070
implementation 'com.google.android.material:material:1.1.0'

gossipML/build.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ dependencies {
140140
testImplementation "io.mockk:mockk:1.9.3"
141141
testImplementation 'org.jetbrains.kotlinx:kotlinx-coroutines-test:1.3.7'
142142
testImplementation "org.robolectric:robolectric:3.4.2"
143-
testImplementation "com.goterl.lazycode:lazysodium-java:4.3.2"
143+
testImplementation "com.goterl:lazysodium-java:5.0.1"
144144
testImplementation 'androidx.core:core-ktx:1.3.2'
145145

146146
// Testing and generating example data

gossipML/src/test/java/gossipML/ipv8/ModelExchangeMessageTest.kt

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package nl.tudelft.trustchain.gossipML.ipv8
22

3-
import com.goterl.lazycode.lazysodium.LazySodiumJava
4-
import com.goterl.lazycode.lazysodium.SodiumJava
3+
import com.goterl.lazysodium.LazySodiumJava
4+
import com.goterl.lazysodium.SodiumJava
55
import nl.tudelft.ipv8.keyvault.LibNaClSK
66
import nl.tudelft.ipv8.util.hexToBytes
77
import nl.tudelft.trustchain.gossipML.models.OnlineModel

ig-ssi/build.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ dependencies {
8282
implementation 'io.github.microutils:kotlin-logging:1.7.7'
8383
implementation 'com.github.tony19:logback-android:2.0.0'
8484

85-
implementation 'com.mattskala:itemadapter:0.3'
85+
implementation 'com.github.MattSkala:recyclerview-itemadapter:0.4'
8686

8787
// Testing
8888
testImplementation 'junit:junit:4.12'

kotlin-ipv8

musicdao-datafeeder/build.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ dependencies {
77
// implementation project(':common')
88
api(project(':ipv8-jvm')){
99
exclude group: 'org.slf4j'
10-
exclude group: 'com.goterl.lazycode'
10+
exclude group: 'com.goterl'
1111
exclude group: 'org.bouncycastle'
1212
}
1313

musicdao/build.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ dependencies {
9999
implementation 'org.knowm.xchange:xchange-binance:5.0.1'
100100

101101
// Crypto library for testing
102-
testImplementation "com.goterl.lazycode:lazysodium-java:4.2.4"
102+
testImplementation "com.goterl:lazysodium-java:5.0.1"
103103

104104
// Testing
105105
testImplementation 'junit:junit:4.12'

musicdao/src/test/java/com/example/musicdao/FaucetEndpointTest.kt

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package com.example.musicdao
22

3+
import org.junit.Ignore
34
import org.junit.Test
45
import java.io.InputStream
56
import java.net.URL
@@ -9,6 +10,7 @@ class FaucetEndpointTest {
910
val endpointAddress = "http://134.122.59.107:3000"
1011

1112
@Test
13+
@Ignore("Unreliable tests") // unit test should not depend on external server
1214
fun getCoins() {
1315
val obj = URL("$endpointAddress?id=$id")
1416
val con: InputStream? = obj.openStream()

musicdao/src/test/java/com/example/musicdao/catalog/PlaylistCoverFragmentTest.kt

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package com.example.musicdao.catalog
22

3-
import com.goterl.lazycode.lazysodium.LazySodiumJava
4-
import com.goterl.lazycode.lazysodium.SodiumJava
3+
import com.goterl.lazysodium.LazySodiumJava
4+
import com.goterl.lazysodium.SodiumJava
55
import nl.tudelft.ipv8.attestation.trustchain.*
66
import nl.tudelft.ipv8.keyvault.JavaCryptoProvider
77
import nl.tudelft.ipv8.keyvault.LibNaClSK

musicdao/src/test/java/com/example/musicdao/ipv8/KeywordSearchMessageTest.kt

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package com.example.musicdao.ipv8
22

3-
import com.goterl.lazycode.lazysodium.LazySodiumJava
4-
import com.goterl.lazycode.lazysodium.SodiumJava
3+
import com.goterl.lazysodium.LazySodiumJava
4+
import com.goterl.lazysodium.SodiumJava
55
import nl.tudelft.ipv8.keyvault.LibNaClSK
66
import nl.tudelft.ipv8.util.hexToBytes
77
import org.junit.Assert

peerchat/build.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ dependencies {
8484
implementation 'io.github.microutils:kotlin-logging:1.7.7'
8585
implementation 'com.github.tony19:logback-android:2.0.0'
8686

87-
implementation 'com.mattskala:itemadapter:0.4'
87+
implementation 'com.github.MattSkala:recyclerview-itemadapter:0.4'
8888
implementation 'com.github.bumptech.glide:glide:4.11.0'
8989
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
9090
implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'

trustchain-explorer/build.gradle

+2-1
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,8 @@ dependencies {
8080
implementation 'io.github.microutils:kotlin-logging:1.7.7'
8181
implementation 'com.github.tony19:logback-android:2.0.0'
8282

83-
implementation 'com.mattskala:itemadapter:0.4'
83+
implementation 'com.github.MattSkala:recyclerview-itemadapter:0.4'
84+
8485

8586
// Testing
8687
testImplementation 'junit:junit:4.12'

trustchain-payloadgenerator/build.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ dependencies {
7171
// Animation
7272
implementation 'com.airbnb.android:lottie:3.4.0'
7373

74-
implementation 'com.mattskala:itemadapter:0.4'
74+
implementation 'com.github.MattSkala:recyclerview-itemadapter:0.4'
7575

7676
// Kotlin
7777
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"

trustchain-trader/build.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ dependencies {
7171
// Animation
7272
implementation 'com.airbnb.android:lottie:3.4.0'
7373

74-
implementation 'com.mattskala:itemadapter:0.4'
74+
implementation 'com.github.MattSkala:recyclerview-itemadapter:0.4'
7575

7676
// Kotlin
7777
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"

0 commit comments

Comments
 (0)