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 numpy as np | |
import matplotlib.pyplot as plt | |
from scipy.stats import multivariate_normal | |
def plot_bivariate_normal(covmat, filename, x_range=(-4, 4), y_range=(-4, 4), grid_size=100): | |
""" | |
Plots the bivariate normal distribution in both 3D and top view. | |
Parameters: | |
- covmat: Covariance matrix for the bivariate normal distribution. |
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 numpy as np | |
import matplotlib.pyplot as plt | |
import seaborn as sns | |
from mpl_toolkits.mplot3d import Axes3D | |
# Step 1: Define the parameters | |
rho = 0 # Correlation coefficient | |
n_samples = 100000 # Number of samples to generate | |
# Step 2: Generate independent standard normal variables |
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.
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.
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 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 pyspark.sql.functions import explode | |
from pyspark.sql.functions import split | |
from pyspark.streaming import StreamingContext | |
from pyspark.sql import SparkSession | |
import time | |
spark = SparkSession.builder \ | |
.appName('Streaming') \ | |
.getOrCreate() |
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
const express = require('express') | |
const path = require('path') | |
const httpPort = 1026 | |
const app = express() | |
app.use(express.static(path.join(__dirname, './'))) | |
app.get('/', function(req, res) { |
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
def callPreprocessData(fn='/home/someusr/Downloads/flows.csv'): | |
data=pd.read_csv(fn) | |
print(data.head(3)) | |
data['Bytes']=data['Bytes'].fillna(0) | |
data['Bytes']=data['Bytes'].astype(str) | |
#silly nfdump writes bytes as integer but sometimes it converts it to | |
#mb. The following finds those entries and converts them into bytes. | |
data.loc[data['Bytes'].str.contains('M'),'Bytes'] = data[data['Bytes'].str.contains('M')]['Bytes'].apply(lambda x: float(x[1:-2])*1024*1024) | |
data['Bytes']=data['Bytes'].astype(int) |
NewerOlder