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 matplotlib.pyplot as plt | |
from pandas_datareader import data | |
df = data.DataReader("RELIANCE.NS", | |
data_source = "yahoo", | |
start = "2016-04-28", | |
end = "2021-03-28") | |
plt.style.use("fivethirtyeight") | |
plt.figure(figsize=(15,10)) |
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 checkFunc(k, input_nums): | |
for i in range(len(input_nums)): | |
for j in range(i+1,len(input_nums)): | |
if(input_nums[i] + input_nums[j] == k): | |
return True | |
return False | |
input_nums = list(map(int, input().split(" "))) | |
k = int(input()) | |
print(checkFunc(k, input_nums)) |
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 seaborn as sns | |
import matplotlib.pyplot as plt | |
from pandas_datareader import data | |
df = data.DataReader("RELIANCE.NS", | |
data_source = "yahoo", | |
start = "2010-04-28", | |
end = "2021-03-28") | |
plt.style.use("fivethirtyeight") |
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
from pandas_datareader import data | |
import pandas as pd | |
import matplotlib.pyplot as plt | |
import seaborn as sns | |
df = data.DataReader("RELIANCE.NS", | |
data_source = "yahoo", | |
start = "2010-01-28", | |
end = "2020-12-28") |
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
from pandas_datareader import data | |
import pandas as pd | |
import matplotlib.pyplot as plt | |
import seaborn as sns | |
df = data.DataReader("RELIANCE.NS", | |
data_source = "yahoo", | |
start = "2010-01-28", | |
end = "2020-12-28") |
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
from pandas_datareader import data | |
import statsmodels.api as sm | |
from pylab import rcParams | |
import pandas as pd | |
import matplotlib.pyplot as plt | |
import seaborn as sns | |
df = data.DataReader("RELIANCE.NS", | |
data_source = "yahoo", |
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
dataframe = pd.read_csv("Data_Entry_2017_v2020.csv") | |
#Enumerating all column names | |
columns = ["Image"] | |
for i in dataframe["Finding Labels"].values: | |
for j in i.split("|"): | |
if j not in columns: | |
columns.append(j) | |
labels = columns.copy() | |
labels.remove("Image") |
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 isOverlap(s1, s2): | |
total = set(s1).intersection(set(s2)) | |
return [len(total), total] | |
def overlapcheck(trainset, valset, testset): | |
patid_train = [] | |
patid_val = [] | |
patid_test = [] | |
for name in trainset['Image'].values: | |
patid_train.append(int(name.split("_")[0])) |
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
num = np.random.randint(trainset.shape[0]) | |
sample = plt.imread(os.path.join(img_dir,trainset.iloc[[num]]["Image"].values[0])) | |
plt.figure(figsize=(15, 15)) | |
plt.title(dataframe[dataframe["Image Index"] == trainset.iloc[[num]]["Image"].values[0]].values[0][1]) | |
plt.imshow(sample, cmap = 'gray') | |
plt.colorbar() | |
trainset.iloc[[num]] | |
print("Maximum Pixel Value: ", sample.max()) | |
print("Minimum Pixel Value: ", sample.min()) |
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
from keras.preprocessing.image import ImageDataGenerator | |
#To standardize the images, we use samplewise_center = True and samplewize_std_normalization = True | |
traingen = ImageDataGenerator(samplewise_center=True, samplewise_std_normalization= True) | |
traingenerator = traingen.flow_from_dataframe( | |
dataframe=trainset, | |
directory="images", | |
x_col="Image", | |
y_col= labels, | |
class_mode="raw", |
OlderNewer