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 shap | |
| import streamlit as st | |
| import streamlit.components.v1 as components | |
| import xgboost | |
| import matplotlib.pyplot as plt | |
| @st.cache | |
| def load_data(): | |
| return shap.datasets.boston() |
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
| let x; | |
| let y; | |
| let xspeed; | |
| let yspeed; | |
| let r,g,b ; | |
| function preload() { | |
| logo = loadImage("logo.png") | |
| } |
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
| custom_data_path = 'path_to_your_ner_dataset.jsonl' | |
| import json | |
| with open(custom_data_path, 'r', encoding="utf8") as json_file: | |
| json_list = list(json_file) | |
| dataset = [json.loads(jline) for jline in json_list] | |
| print(f"number of examples : {len(dataset)}") | |
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 numpy as np | |
| import pandas as pd | |
| import shap | |
| explainer = shap.TreeExplainer("your_tree_model") | |
| shap_values = explainer.shap_values(X_train) | |
| scores= np.abs(shap_values).mean(0) | |
| feature_importance = pd.DataFrame(list(zip(X_train.columns, sum(scores))), columns=['feature','feature_importance_score']) | |
| feature_importance.sort_values(by=['feature_importance_score'], ascending=False,inplace=True) |
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 cv2 | |
| import numpy as np | |
| def augment_brightness(img, scale): | |
| img = cv2.cvtColor(img, cv2.COLOR_BGR2HSV) | |
| h, s, v = cv2.split(img) | |
| scale = 0.5 | |
| v = np.clip(v * scale, 0, 255, out=v) | |
| img = cv2.merge((h, s, v)) |
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 streamlit as st | |
| import numpy as np | |
| from PIL import Image | |
| import cv2 | |
| from io import BytesIO | |
| import base64 | |
| import uuid | |
| import re | |
| @st.cache |
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 mediapipe as mp | |
| import cv2 | |
| mp_objectron = mp.solutions.objectron | |
| mp_drawing = mp.solutions.drawing_utils | |
| if __name__ == '__main__': | |
| objectron = mp_objectron.Objectron(static_image_mode=True, | |
| max_num_objects=5, | |
| min_detection_confidence=0.5, |
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 google.cloud import bigquery | |
| import os | |
| import pandas as pd | |
| os.environ["GOOGLE_APPLICATION_CREDENTIALS"] = "YOURGCPSERVICEACCOUNTKEY.json" | |
| GCP_PROJECT_ID = "YOURGCPPROJECT" | |
| client = bigquery.Client(project=GCP_PROJECT_ID) | |
| datasets = list(client.list_datasets()) | |
| project = client.project |
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 cv2 | |
| filename = "yourfilename.jpg" | |
| frame = cv2.imread(filename) | |
| overlay = frame.copy() | |
| text = "I love opencv" | |
| font, font_scale, font_thickness = cv2.FONT_ITALIC, 3.5, 5 | |
| textsize = cv2.getTextSize(text, font, font_scale, font_thickness)[0] # get text size |
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
| trainingInput: | |
| scaleTier: CUSTOM | |
| masterType: n1-standard-4 | |
| hyperparameters: | |
| goal: MAXIMIZE | |
| maxTrials: 90 | |
| maxParallelTrials: 8 | |
| algorithm: GRID_SEARCH | |
| hyperparameterMetricTag: val_accuracy | |
| params: |
NewerOlder