data-science

How do I replace values in a matrix from an uploaded CSV file in R?

情到浓时终转凉″ 提交于 2019-12-13 03:39:26
问题 These are the steps I took: 1) Read in CSV file rawdata <- read.csv('name of my file', stringsAsFactors=FALSE) 2) Cleaned my data by removing certain records based on x-criteria data <- rawdata[!(rawdata$YOURID==""), all()] data <- data[(data$thiscolumn=="right"), all()] data <- data[(data$thatcolumn=="right"), all()] 3) Now I want to replace certain values throughout the whole matrix with a number (replace a string with a number value). I have tried the following commands and nothing works

MTCNN_face_detection_alignment lagging in IP camera, Convention behind opencv cv2 videocapture frame matrix

倖福魔咒の 提交于 2019-12-13 03:11:59
问题 I am just trying to detect and recognize faces from the frame read through CV2 VideoCapture. For detection, using Tensorflow implementation of the face detection / alignment algorithm found at https://github.com/kpzhang93/MTCNN_face_detection_alignment. MTCNN Face detection process has no lag with builtin webcam and external camera connected with USB. However when it comes from IP camera there is a considerable lagging from detection algorithm. The algorithm takes more time to process single

How and When to use Chain Indexing in Python Pandas?

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-13 02:51:06
问题 I am taking a Data Science course about data analysis in Python. At one point in the course the professor says: You can chain operations together. For instance, we could have rewritten the query for all Store 1 costs as df.loc['Store 1']['Cost']. This looks pretty reasonable and gets us the result we wanted. But chaining can come with some costs and is best avoided if you can use another approach. In particular, chaining tends to cause Pandas to return a copy of the DataFrame instead of a

LSTM Producing Same Predictions for any Input

混江龙づ霸主 提交于 2019-12-13 02:49:28
问题 So, I am currently working on a machine learning algorithm problem pertaining to car speeds and angles, and I'm trying to improve upon some of my work. I recently got done with an XGBRegressor that yielded between 88 - 95% accuracy on my cross-validated data. However, I'm trying to improve upon it, so I've been looking into the LSTM algorithm, because my data is time-series dependent. Essentially, every link includes a steering angle, the previous times steering angle (x-1), the time before

How to plot a subset of forecast in R?

早过忘川 提交于 2019-12-13 00:53:57
问题 I have a simple R script to create a forecast based on a file. Data has been recorded since 2014 but I am having trouble trying to accomplish below two goals: Plot only a subset of the forecast information (starting on 11/2017 onwards). Include month and year in a specific format (i.e. Jun 17). Here is the link to the dataset and below you will find the code made by me so far. # Load required libraries library(forecast) library(ggplot2) # Load dataset emea <- read.csv(file="C:/Users/nsoria

How can I built a function that calculate cosine similarity in language R?

自古美人都是妖i 提交于 2019-12-13 00:52:48
问题 ios d.0 d.1 d.2 d.3 d.4 d.5 1 190371877 HDa 2Pb 2 BxU BuQ Bve 2 190890807 HCK 2Pb 2 09 F G 3 193999742 HDa 2Pb 2 1wL 1ye 4 192348099 HDa 2Pb 2 2WP 5 194907960 HDa 2Pb 2 Y F G 6 194306872 HDa 2Pb 2 2WP 7 190571682 HDa 2Pb 2 i F C 8 195878080 HDa 2Pb 2 Y F G 9 195881580 HDa 2Pb 2 Y F G 10 193746161 HDa 2Pb 2 1wL Here is my codes below.ı just able to done for compare 2 vectors and now ı want to built a function library('lsa') td = tempfile() dir.create(td) write( c("HDa","2Pb","2","BxU","BuQ",

Disable side panel when exporting Kepler.gl map?

别等时光非礼了梦想. 提交于 2019-12-12 23:13:01
问题 I loaded my data into kepler.gl (https://kepler.gl/) and created a visual I would like to post online by embedding the code into a blogpost. However, I want the readers/users not to be able to see and access the side panel, but rather only with the main view of the map. Is there any way to do so or any parameters I can change when exporting the html? 回答1: To solve the issue, one must replace the reducers block: const reducers = (function createReducers(redux, keplerGl) { return redux

Creating a boxplot FacetGrid in Seaborn for python

和自甴很熟 提交于 2019-12-12 14:52:09
问题 I'm trying to create a 4x4 FacetGrid in seaborn for 4 boxplots, each of which is split into 3 boxplots based on the iris species in the iris dataset. Currently, my code looks like this: sns.set(style="whitegrid") iris_vis = sns.load_dataset("iris") fig, axes = plt.subplots(2, 2) ax = sns.boxplot(x="Species", y="SepalLengthCm", data=iris, orient='v', ax=axes[0]) ax = sns.boxplot(x="Species", y="SepalWidthCm", data=iris, orient='v', ax=axes[1]) ax = sns.boxplot(x="Species", y="PetalLengthCm",

Sorting datetime objects by hour to a Pandas dataframe, then visualize to histogram with Matplotlib

南笙酒味 提交于 2019-12-12 12:30:42
问题 I need to sort viewers by hour to a histogram. I have some experience using Matplotlib to do that, but I can't find out what is the most pragmatic way to sort the dates by hour. First I read the data from a JSON file, then store the two relevant datatypes in a pandas Dataframe, like this: data = pd.read_json('data/data.json') session_duration = pd.to_datetime(data.session_duration, unit='s').dt.time time = pd.to_datetime(data.time, format='%H:%M:%S').dt.time viewers = [] for x, y in zip(time,

How to get number of rows, columns /dimensions of tensorflow.data.Dataset?

主宰稳场 提交于 2019-12-12 12:19:59
问题 Like pandas_df.shape is there any way for tensorflow.data.Dataset? Thanks. 回答1: I'm not familiar with something built-in, but the shapes could be retrieved from Dataset._tensors attribute. Example: import tensorflow as tf def dataset_shapes(dataset): try: return [x.get_shape().as_list() for x in dataset._tensors] except TypeError: return dataset._tensors.get_shape().as_list() And usage: from sklearn.datasets import make_blobs x_train, y_train = make_blobs(n_samples=10, n_features=2, centers=[