Skip to content

Instantly share code, notes, and snippets.

View moreka's full-sized avatar

Mohammad Reza Karimi moreka

  • ETH Zürich
View GitHub Profile
@moreka
moreka / huber.py
Created February 20, 2024 10:41
Huber Loss vs Squared Loss
from functools import partial
from typing import Callable, List
def deriv_squared_loss(x: float) -> float:
"""Derivative of the squared loss l(x) = 1/2 x^2"""
return x
def deriv_huber_loss(x: float, delta: float) -> float:
Please note that these warnings are just used to help the Homebrew maintainers
with debugging if you file an issue. If everything you use Homebrew for is
working fine: please don't worry and just ignore them. Thanks!
Warning: The filesystem on / appears to be case-sensitive.
The default macOS filesystem is case-insensitive. Please report any apparent problems.

Broadcast Code Readme

This project is Python2-compatible and have issues while running with python 3. So please use Python2 (We used Anaconda's CPython distribution, maybe PyPy would be faster, but I don't even know whether it's OK to move to PyPy)

1. Data Access

All data access related classes are in data package. We suppose there are two SQLite databases, namely db.sqlite3 and links.sqlite3 which are stored on shared memory (/dev/shm) for faster access (they should be copied, in case of vanishing). First DB, holds tweets table with following schema:

CREATE TABLE tweets (user_id integer, tweet_time integer);