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 | |
import matplotlib.pyplot as plt | |
from statsmodels.tsa.holtwinters import SimpleExpSmoothing | |
from sklearn.metrics import mean_squared_error | |
# Assuming df_list[100]['y_lag'] is your time series data | |
# Ensure it's a pandas Series for compatibility with SimpleExpSmoothing | |
data = pd.Series(df_list[100]['y_lag']) |
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 requests | |
import pandas as pd | |
number_of_pages = 100 | |
#number_of_ads = number_of_pages * per_page | |
job_title = ["'Data Analyst' and 'data scientist'"] | |
for job in job_title: |
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
class Vector2D: | |
def __init__(self, x, y): | |
self.x = x | |
self.y = y | |
def __str__(self): | |
return f"Vector2D({self.x}, {self.y})" | |
def __add__(self, other): | |
if isinstance(other, Vector2D): |
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 os | |
import sys | |
# Pobierz aktualną ścieżkę do bieżącego pliku | |
current_path = os.path.dirname(os.path.abspath(__file__)) | |
# Dodaj dwa poziomy wyżej do ścieżki | |
two_levels_up = os.path.abspath(os.path.join(current_path, "../../")) | |
# Dodaj nową ścieżkę do sys.path, aby Python mógł znaleźć moduł |
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
def compare_algorithms2df(MLA, X_train, X_test, y_train, y_test, sorted_by_measure='accuracy'): | |
#show grid with compared results - accuracy, recall, ppv, f1-measure, mcc | |
MLA_columns = [] | |
MLA_compare = pd.DataFrame(columns = MLA_columns) | |
row_index = 0 | |
for alg in MLA: |
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 pyspark | |
#import udf | |
from pyspark.sql.functions import udf | |
from pyspark.sql.types import BooleanType | |
from shapely.geometry import Point, Polygon | |
# Create a SparkContext | |
sc = pyspark.SparkContext() |
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
class IP: | |
def __init__(self, ip_address, filename): | |
self.ip_address = ip_address | |
self.filename = filename | |
def random_ip_nonlocal(self): | |
lista_ip_non_local = [] | |
for i in range(self.ip_address): | |
ip = "" |
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
p.generate_ips() | |
(['127.247.9.229'], ['124.72.36.132']) |
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
function p = predict(theta, X) | |
%PREDICT Predict whether the label is 0 or 1 using learned logistic | |
%regression parameters theta | |
% p = PREDICT(theta, X) computes the predictions for X using a | |
% threshold at 0.5 (i.e., if sigmoid(theta'*x) >= 0.5, predict 1) | |
m = size(X, 1); % Number of training examples | |
% You need to return the following variables correctly | |
p = zeros(m, 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
function [J, grad] = costFunction(theta, X, y) | |
%COSTFUNCTION Compute cost and gradient for logistic regression | |
% J = COSTFUNCTION(theta, X, y) computes the cost of using theta as the | |
% parameter for logistic regression and the gradient of the cost | |
% w.r.t. to the parameters. | |
% Initialize some useful values | |
m = length(y); % number of training examples | |
% You need to return the following variables correctly |
NewerOlder