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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>OCR PDFs and images directly in your browser</title> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<script defer data-domain="tools.simonwillison.net" src="https://plausible.io/js/script.js"></script> | |
<script type="module"> | |
import pdfjsDist from 'https://cdn.jsdelivr.net/npm/[email protected]/+esm'; | |
pdfjsLib.GlobalWorkerOptions.workerSrc = |
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
# Example 1: getattr() function | |
class Person: | |
def __init__(self, age): | |
self.age = age | |
# create a Person object with age 36 | |
person = Person(36) | |
# get the value of the attribute 'age' | |
print('The age of Person ',getattr(person, 'age', 40)) |
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
# 31,female,25.74,0,no,southeast | |
input_data = (31,1,25.74,0,1,0) | |
#changing input_data to a numpy array | |
input_data_as_numpy_array=np.asarray(input_data) | |
#reshape the array | |
input_data_reshaped=input_data_as_numpy_array.reshape(1,-1) | |
prediction=regressor.predict(input_data_reshaped) |
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
# prediction on the test data | |
test_data_prediction= regressor.predict(X_test) | |
r2_test=metrics.r2_score(Y_test, test_data_prediction) | |
print('R squared value: ', r2_test) |
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
# predictio on the training data | |
training_data_prediction= regressor.predict(X_train) | |
# R squared value | |
r2_train=metrics.r2_score(Y_train, training_data_prediction) | |
print('R squared value: ', r2_train) |
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
# loading the linear regression model | |
regressor = LinearRegression() | |
regressor.fit(X_train, Y_train) |
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
X = insurance_dataset.drop(columns='charges', axis=1) | |
Y = insurance_dataset['charges'] | |
X_train, X_test, Y_train, Y_test=train_test_split(X, Y, test_size=0.2, random_state=2) |
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
# encoding sex column | |
insurance_dataset.replace({'sex':{'male':0, 'female':1}}, inplace=True) | |
# encoding smoker column | |
insurance_dataset.replace({'smoker':{'yes':0, 'no':1}}, inplace=True) | |
# encoding region column | |
insurance_dataset.replace({'region':{'southeast':0, 'southwest':1, 'northeast':2, 'northwest':3}}, inplace=True) |
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
<!doctype html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8"> | |
<title>Diamond Life</title> | |
<base href="/"> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | |
<!-- <link rel="icon" type="image/x-icon" href="favicon.ico"> --> | |
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css"> |
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
INSERT INTO CONSTRAINT_DEMO2 VALUES | |
(1,'AAA',22,'BBB'), | |
(2,'BBB',23,'CCC'), | |
(3,'CCC',24,'DDD'), | |
(4,'DDD',22,'AAA'); |
NewerOlder