Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import pandas as pd | |
from numpy import bincount, log, log1p | |
from scipy.sparse import coo_matrix, linalg | |
class ImplicitCF: | |
def __init__(self): | |
self.df = pd.read_csv("lastfm-dataset-360K/usersha1-artmbid-artname-plays.tsv", sep='\t', header=None, names=['user', 'artist', 'plays'], usecols=[0,2,3]) | |
self.df['user'] = self.df['user'].astype("category") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import pandas as pd | |
from numpy import bincount, log, log1p | |
from scipy.sparse import coo_matrix, linalg | |
class ExplicitCF: | |
def __init__(self): | |
self.df = pd.read_csv("ml-100k/u.data", sep='\t', header=None, names=['user', 'item', 'rating'], usecols=range(3)) | |
self.df['user'] = self.df['user'].astype("category") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import io | |
import fasttext | |
def load_vectors(fname): | |
fin = io.open(fname, 'r', encoding='utf-8', newline='\n', errors='ignore') | |
n, d = map(int, fin.readline().split()) | |
data = {} | |
for line in fin: | |
tokens = line.rstrip().split(' ') | |
data[tokens[0]] = map(float, tokens[1:]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import io | |
import fasttext | |
def load_vectors(fname): | |
fin = io.open(fname, 'r', encoding='utf-8', newline='\n', errors='ignore') | |
n, d = map(int, fin.readline().split()) | |
data = {} | |
for line in fin: | |
tokens = line.rstrip().split(' ') | |
data[tokens[0]] = map(float, tokens[1:]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; replace the below frequency number with the original frequency used to embed the secret | |
(mult *track* (hzosc 17500.0)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;nyquist plug-in | |
;version 1 | |
;type process | |
;name "Subliminal..." | |
;action "Subliminal..." | |
;control carrier "Carrier" real "Hz" 17500 14000 20000 | |
(setf carrier (max 14000 (min carrier 20000))) | |
;; We have two Nyquist frequencies, carrier/2 and *sound-srate*/2. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Use wave package (native to Python) for reading the received audio file | |
import wave | |
song = wave.open("song_embedded.wav", mode='rb') | |
# Convert audio to byte array | |
frame_bytes = bytearray(list(song.readframes(song.getnframes()))) | |
# Extract the LSB of each byte | |
extracted = [frame_bytes[i] & 1 for i in range(len(frame_bytes))] | |
# Convert byte array back to string | |
string = "".join(chr(int("".join(map(str,extracted[i:i+8])),2)) for i in range(0,len(extracted),8)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# We will use wave package available in native Python installation to read and write .wav audio file | |
import wave | |
# read wave audio file | |
song = wave.open("song.wav", mode='rb') | |
# Read frames and convert to byte array | |
frame_bytes = bytearray(list(song.readframes(song.getnframes()))) | |
# The "secret" text message | |
string='Peter Parker is the Spiderman!' | |
# Append dummy data to fill out rest of the bytes. Receiver shall detect and remove these characters. |