feature-extraction

How to create windows based on time when i have irregular sample rate?

How to create windows based on time when i have irregular sample rate? Question: Μy dataset consists of timeseries which are measurements from sensors (accelerometer, gyroscope, magnetometer). I need to create windows in order to extract features and create feature vectors. The problem is that the sample rate is irregular. For instance, sensors may stop …

Total answers: 3

How to select user_id rows pandas

How to select user_id rows pandas Question: How can I calculate the first visited date and the last visited date before an order was placed by the user? USER ID TYPE DATE 1 Visited September 14, 2020 1 Visited October 4, 2020 1 Visited October 24, 2020 1 Ordered November 1, 2020 2 Visited September …

Total answers: 2

Best way to get a specific column as y in pandas DataFrame

Best way to get a specific column as y in pandas DataFrame Question: I want to extract one specific column as y from a pandas DataFrame. I found two ways to do this so far: # The First way y_df = df[specific_column] y_array = np.array(y_df) X_df = df.drop(columns=[specific_column]) X_array = np.array(X_df) # The second way …

Total answers: 1

Can you explain how the feature is extracted from the following code of CNN

Can you explain how the feature is extracted from the following code of CNN Question: How the Image Features are extracted from the following convolutional neural network code import tensorflow as tf from tensorflow.keras.utils import img_to_array df[‘PubChem_ID’] = df[‘PubChem_ID’].apply(str) df_image = [] for i in tqdm(range(df.shape[0])): img = image.load_img(‘/content/drive/MyDrive/3D Conformer/Conformer/’+df[‘PubChem_ID’] [i]+’.png’,target_size=(256,256,3)) img = image.img_to_array(img) img …

Total answers: 1

batch_distance.cpp:274: error: (-215:Assertion failed)

batch_distance.cpp:274: error: (-215:Assertion failed) Question: ` I have the following code : import cv2 import os from os import listdir import numpy as np from PIL import Image from tabulate import tabulate import itertools #sift sift = cv2.SIFT_create() #feature matching bf = cv2.BFMatcher(cv2.NORM_L2, crossCheck=True) # get the path/directory folder_dir = "./runs/myDetect/SIFT" col_names = [] data …

Total answers: 1

Get features names from scikit pipelines

Get features names from scikit pipelines Question: I am working on ML regression problem where I defined a pipeline like below based on a tutorial online. My code looks like below pipe1 = Pipeline([(‘poly’, PolynomialFeatures()), (‘fit’, linear_model.LinearRegression())]) pipe2 = Pipeline([(‘poly’, PolynomialFeatures()), (‘fit’, linear_model.Lasso())]) pipe3 = Pipeline([(‘poly’, PolynomialFeatures()), (‘fit’, linear_model.Ridge())]) pipe4 = Pipeline([(‘poly’, PolynomialFeatures()), (‘fit’, linear_model.TweedieRegressor())]) …

Total answers: 1

Recursive feature elimination (RFE) with random forest

Recursive feature elimination (RFE) with random forest Question: I want to use Recursive feature elimination (RFE) for feature selection on my datase using random forest. I came up with this code: from sklearn.feature_selection import RFE # Create the RFE object and rank each pixel clf_rf_3 = RandomForestClassifier() rfe = RFE(estimator=clf_rf_3, n_features_to_select=6, step=1) rfe = rfe.fit(X_train, …

Total answers: 1

get_feature_names_out from Linear SVC pipeline and sklearn

get_feature_names_out from Linear SVC pipeline and sklearn Question: i’m struggling to understand what are the most used feature for text classification. i’ve been trying 2 methods found here on stackoverflow the first def print_top10(vectorizer, clf, class_labels): """Prints features with the highest coefficient values, per class""" feature_names = vectorizer.get_feature_names_out() for i, class_label in enumerate(class_labels): top10 = …

Total answers: 1