mirror of
https://github.com/TheAlgorithms/Python.git
synced 2025-07-05 01:09:40 +08:00
isort --profile black . (#2181)
* updating DIRECTORY.md * isort --profile black . * Black after * updating DIRECTORY.md Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
This commit is contained in:
@ -1,10 +1,9 @@
|
||||
# Gaussian Naive Bayes Example
|
||||
|
||||
from sklearn.naive_bayes import GaussianNB
|
||||
from sklearn.metrics import plot_confusion_matrix
|
||||
from matplotlib import pyplot as plt
|
||||
from sklearn.datasets import load_iris
|
||||
from sklearn.metrics import plot_confusion_matrix
|
||||
from sklearn.model_selection import train_test_split
|
||||
import matplotlib.pyplot as plt
|
||||
from sklearn.naive_bayes import GaussianNB
|
||||
|
||||
|
||||
def main():
|
||||
|
@ -52,11 +52,12 @@ Usage:
|
||||
|
||||
|
||||
"""
|
||||
import warnings
|
||||
|
||||
import numpy as np
|
||||
import pandas as pd
|
||||
from matplotlib import pyplot as plt
|
||||
from sklearn.metrics import pairwise_distances
|
||||
import warnings
|
||||
|
||||
warnings.filterwarnings("ignore")
|
||||
|
||||
@ -193,7 +194,7 @@ def kmeans(
|
||||
|
||||
# Mock test below
|
||||
if False: # change to true to run this test case.
|
||||
import sklearn.datasets as ds
|
||||
from sklearn import datasets as ds
|
||||
|
||||
dataset = ds.load_iris()
|
||||
k = 3
|
||||
|
@ -1,5 +1,6 @@
|
||||
import numpy as np
|
||||
from collections import Counter
|
||||
|
||||
import numpy as np
|
||||
from sklearn import datasets
|
||||
from sklearn.model_selection import train_test_split
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
from sklearn.model_selection import train_test_split
|
||||
from sklearn.datasets import load_iris
|
||||
from sklearn.model_selection import train_test_split
|
||||
from sklearn.neighbors import KNeighborsClassifier
|
||||
|
||||
# Load iris file
|
||||
|
@ -41,11 +41,9 @@
|
||||
|
||||
Author: @EverLookNeverSee
|
||||
"""
|
||||
|
||||
from math import log
|
||||
from os import name, system
|
||||
from random import gauss
|
||||
from random import seed
|
||||
from random import gauss, seed
|
||||
|
||||
|
||||
# Make a training dataset drawn from a gaussian distribution
|
||||
|
@ -7,8 +7,8 @@ We try to set the weight of these features, over many iterations, so that they b
|
||||
fit our dataset. In this particular code, I had used a CSGO dataset (ADR vs
|
||||
Rating). We try to best fit a line through dataset and estimate the parameters.
|
||||
"""
|
||||
import requests
|
||||
import numpy as np
|
||||
import requests
|
||||
|
||||
|
||||
def collect_dataset():
|
||||
|
@ -14,14 +14,12 @@ Helpful resources:
|
||||
Coursera ML course
|
||||
https://medium.com/@martinpella/logistic-regression-from-scratch-in-python-124c5636b8ac
|
||||
"""
|
||||
|
||||
import numpy as np
|
||||
import matplotlib.pyplot as plt
|
||||
from matplotlib import pyplot as plt
|
||||
from sklearn import datasets
|
||||
|
||||
# get_ipython().run_line_magic('matplotlib', 'inline')
|
||||
|
||||
from sklearn import datasets
|
||||
|
||||
|
||||
# In[67]:
|
||||
|
||||
|
@ -4,14 +4,12 @@
|
||||
* http://colah.github.io/posts/2015-08-Understanding-LSTMs
|
||||
* https://en.wikipedia.org/wiki/Long_short-term_memory
|
||||
"""
|
||||
|
||||
from keras.layers import Dense, LSTM
|
||||
from keras.models import Sequential
|
||||
import numpy as np
|
||||
import pandas as pd
|
||||
from keras.layers import LSTM, Dense
|
||||
from keras.models import Sequential
|
||||
from sklearn.preprocessing import MinMaxScaler
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
"""
|
||||
First part of building a model is to get the data and prepare
|
||||
|
@ -1,6 +1,5 @@
|
||||
from sklearn.neural_network import MLPClassifier
|
||||
|
||||
|
||||
X = [[0.0, 0.0], [1.0, 1.0], [1.0, 0.0], [0.0, 1.0]]
|
||||
y = [0, 1, 0, 0]
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
import matplotlib.pyplot as plt
|
||||
import pandas as pd
|
||||
from matplotlib import pyplot as plt
|
||||
from sklearn.linear_model import LinearRegression
|
||||
|
||||
# Splitting the dataset into the Training set and Test set
|
||||
|
@ -1,10 +1,9 @@
|
||||
# Random Forest Classifier Example
|
||||
|
||||
from matplotlib import pyplot as plt
|
||||
from sklearn.datasets import load_iris
|
||||
from sklearn.model_selection import train_test_split
|
||||
from sklearn.ensemble import RandomForestClassifier
|
||||
from sklearn.metrics import plot_confusion_matrix
|
||||
import matplotlib.pyplot as plt
|
||||
from sklearn.model_selection import train_test_split
|
||||
|
||||
|
||||
def main():
|
||||
|
@ -1,10 +1,8 @@
|
||||
# Random Forest Regressor Example
|
||||
|
||||
from sklearn.datasets import load_boston
|
||||
from sklearn.model_selection import train_test_split
|
||||
from sklearn.ensemble import RandomForestRegressor
|
||||
from sklearn.metrics import mean_absolute_error
|
||||
from sklearn.metrics import mean_squared_error
|
||||
from sklearn.metrics import mean_absolute_error, mean_squared_error
|
||||
from sklearn.model_selection import train_test_split
|
||||
|
||||
|
||||
def main():
|
||||
|
@ -36,9 +36,9 @@ import os
|
||||
import sys
|
||||
import urllib.request
|
||||
|
||||
import matplotlib.pyplot as plt
|
||||
import numpy as np
|
||||
import pandas as pd
|
||||
from matplotlib import pyplot as plt
|
||||
from sklearn.datasets import make_blobs, make_circles
|
||||
from sklearn.preprocessing import StandardScaler
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
from sklearn.datasets import load_iris
|
||||
from sklearn import svm
|
||||
from sklearn.datasets import load_iris
|
||||
from sklearn.model_selection import train_test_split
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user