This file contains hidden or 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 torch | |
import torch.nn as nn | |
import torch.optim as optim | |
from torch.distributions import Categorical | |
import numpy as np | |
# Define a simple Bayesian Neural Network (BNN) with MC Dropout | |
class BayesianNN(nn.Module): | |
def __init__(self, input_dim, output_dim, hidden_dim=50): | |
super(BayesianNN, self).__init__() |
This file contains hidden or 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
from re import I | |
import numpy as np | |
import matplotlib.pyplot as plt | |
from scipy.stats import multivariate_normal | |
# Generate synthetic data (2D points for visualization) | |
def generate_data(): | |
np.random.seed(42) | |
data = np.vstack([ | |
np.random.multivariate_normal([5, 5], [[1, 0], [0, 1]], 50), |
This file contains hidden or 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
#!/usr/bin/env python3 | |
import sys | |
import os | |
import re | |
import subprocess | |
# Function to display help information | |
def display_help(): | |
print("A script to build tex files for your papers") |
This file contains hidden or 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 pandas as pd | |
from geopy.geocoders import Nominatim | |
import folium | |
# Load the CSV file with pandas | |
df = pd.read_csv('access-log.csv') # Replace 'ip_addresses.csv' with your CSV file name | |
filtered_df = df[~df['Source IP'].str.startswith('192.168.1.')] | |
# Initialize geocoder |
This file contains hidden or 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
#diary #pensieri | |
import os | |
def add_tag(file_name): | |
with open(file_name, 'r+') as f: | |
content = f.read() | |
f.seek(0, 0) | |
# if a string is in the file then print helloworld |