This file contains hidden or 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
html, body { | |
margin: 0; | |
padding: 0; | |
height: 100vh; | |
width: 100%; | |
box-sizing: border-box; | |
font-family: Arial, sans-serif; | |
} | |
.center { |
This file contains hidden or 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>Color Palette Generator</title> | |
<link | |
rel="stylesheet" | |
href="{{ url_for('static', filename='css/main.css') }}" | |
/> | |
<script src="https://unpkg.com/@popperjs/core@2"></script> |
This file contains hidden or 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 React from "react"; | |
import { Container, SimpleGrid, Text } from "@chakra-ui/react"; | |
import ProductCard from "./ProductCard"; | |
import useProducts from "../hooks"; | |
import InfiniteScroll from "react-infinite-scroll-component"; | |
const HomePage = () => { | |
const { data, fetchNextPage, hasNextPage } = useProducts(); | |
return ( |
This file contains hidden or 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 React from "react"; | |
import { | |
AspectRatio, | |
Card, | |
CardBody, | |
Heading, | |
Image, | |
Stack, | |
Text, | |
} from "@chakra-ui/react"; |
This file contains hidden or 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 axios from "axios"; | |
import { useInfiniteQuery } from "@tanstack/react-query"; | |
export interface Product { | |
id: number; | |
title: string; | |
price: number; | |
images: string[]; | |
} |
This file contains hidden or 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
final_model = grid_search.best_estimator_ | |
X_test = test_set.drop("charges", axis=1) | |
y_test = test_set["charges"].copy() | |
X_test_prepared = full_pipeline.transform(X_test) | |
final_predictions = final_model.predict(X_test_prepared) | |
final_rmse = np.sqrt(mean_squared_error(y_test, final_predictions)) | |
print(final_rmse) |
This file contains hidden or 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 sklearn.ensemble import RandomForestRegressor | |
from sklearn.model_selection import GridSearchCV | |
param_grid = [ | |
{'n_estimators': [3, 10, 30], 'max_features': [2, 4, 6, 8]}, | |
{'bootstrap': [False], 'n_estimators': [3, 10], 'max_features': [2, 3, 4]} | |
] | |
forest_reg = RandomForestRegressor() |
This file contains hidden or 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 sklearn.ensemble import RandomForestRegressor | |
from sklearn.metrics import mean_squared_error | |
forest_reg = RandomForestRegressor() | |
forest_reg.fit(insurance_prepared, insurance_labels) |
This file contains hidden or 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 sklearn.pipeline import Pipeline | |
from sklearn.preprocessing import StandardScaler, OneHotEncoder | |
from sklearn.compose import ColumnTransformer | |
num_attrs = ["age", "bmi", "children"] | |
cat_attrs = ["sex", "smoker", "region"] | |
num_pipeline = Pipeline([ | |
('std_scaler', StandardScaler()) | |
]) |
This file contains hidden or 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
insurance = train_set.drop("charges", axis=1) | |
insurance_labels = train_set["charges"].copy() |
NewerOlder