This media is not supported in your browser
    VIEW IN TELEGRAM
  Aider got the top score on SWE Bench, a challenging benchmark in which Aider solved real-world problems on #GitHub from popular open source projects like #django, #scikitlearn, #matplotlib, etc.
🟡 Docs
Please open Telegram to view this post
    VIEW IN TELEGRAM
  NUMPY FOR DS.pdf
    4.5 MB
  Let's start at the top...
NumPy contains a broad array of functionality for fast numerical & mathematical operations in Python
The core data-structure within #NumPy is an ndArray (or n-dimensional array)
Behind the scenes - much of the NumPy functionality is written in the programming language C
NumPy functionality is used in other popular #Python packages including #Pandas, #Matplotlib, & #scikitlearn!
✉️  Our Telegram channels: https://t.me/addlist/0f6vfFbEMdAwODBk
NumPy contains a broad array of functionality for fast numerical & mathematical operations in Python
The core data-structure within #NumPy is an ndArray (or n-dimensional array)
Behind the scenes - much of the NumPy functionality is written in the programming language C
NumPy functionality is used in other popular #Python packages including #Pandas, #Matplotlib, & #scikitlearn!
Please open Telegram to view this post
    VIEW IN TELEGRAM
  ❤19
  import seaborn as sns
import pandas as pd
df = pd.DataFrame(np.random.randn(100, 4), columns=['A', 'B', 'C', 'D'])
# sns.pairplot(df) # This line would generate the plot
print("Output: A figure grid opens showing scatterplots for each pair of variables.")
Output: A figure grid opens showing scatterplots for each pair of variables.
#88.
sns.countplot()Shows the counts of observations in each categorical bin using bars.
import seaborn as sns
import pandas as pd
df = pd.DataFrame({'category': ['A', 'B', 'A', 'C', 'A', 'B']})
sns.countplot(x='category', data=df)
print("Output: A figure window opens showing a count plot.")
Output: A figure window opens showing a count plot.
#89.
sns.jointplot()Draws a plot of two variables with bivariate and univariate graphs.
import seaborn as sns
import pandas as pd
df = pd.DataFrame({'x': range(50), 'y': range(50) + np.random.randn(50)})
# sns.jointplot(x='x', y='y', data=df) # This line would generate the plot
print("Output: A figure shows a scatter plot with histograms for each axis.")
Output: A figure shows a scatter plot with histograms for each axis.
#90.
plt.show()Displays all open figures.
import matplotlib.pyplot as plt
plt.plot([1, 2, 3])
# plt.show() # In a script, this is essential to see the plot.
print("Executes the command to render and display the plot.")
Executes the command to render and display the plot.
---
#DataAnalysis #ScikitLearn #Modeling #Preprocessing
Part 9: Scikit-learn - Modeling & Preprocessing
#91.
train_test_split()Splits arrays or matrices into random train and test subsets.
from sklearn.model_selection import train_test_split
import numpy as np
X, y = np.arange(10).reshape((5, 2)), range(5)
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.33)
print(f"X_train shape: {X_train.shape}")
print(f"X_test shape: {X_test.shape}")
X_train shape: (3, 2)
X_test shape: (2, 2)
#92.
StandardScaler()Standardizes features by removing the mean and scaling to unit variance.
from sklearn.preprocessing import StandardScaler
data = [[0, 0], [0, 0], [1, 1], [1, 1]]
scaler = StandardScaler()
print(scaler.fit_transform(data))
[[-1. -1.]
[-1. -1.]
[ 1. 1.]
[ 1. 1.]]
#93.
MinMaxScaler()Transforms features by scaling each feature to a given range, typically [0, 1].
from sklearn.preprocessing import MinMaxScaler
data = [[-1, 2], [-0.5, 6], [0, 10], [1, 18]]
scaler = MinMaxScaler()
print(scaler.fit_transform(data))
[[0. 0. ]
[0.25 0.25]
[0.5 0.5 ]
[1. 1. ]]
#94.
LabelEncoder()Encodes target labels with values between 0 and n_classes-1.
from sklearn.preprocessing import LabelEncoder
le = LabelEncoder()
encoded = le.fit_transform(['paris', 'tokyo', 'paris'])
print(encoded)
[0 1 0]
#95.
OneHotEncoder()Encodes categorical features as a one-hot numeric array.
from sklearn.preprocessing import OneHotEncoder
enc = OneHotEncoder()
X = [['Male'], ['Female'], ['Female']]
print(enc.fit_transform(X).toarray())
[[0. 1.]
[1. 0.]
[1. 0.]]
#96.
LinearRegression()Ordinary least squares Linear Regression model.
from sklearn.linear_model import LinearRegression
X = [[0], [1], [2]]
y = [0, 1, 2]
reg = LinearRegression().fit(X, y)
print(f"Coefficient: {reg.coef_[0]}")
❤2