data-science

Reading Rds file from git

拟墨画扇 提交于 2020-05-18 04:10:19
问题 I am trying to read rds file, directly from GitHub. I am able to read any file from git but when I try to read rds file using gzcon its asking value for con. dat <- readRDS(gzcon(url("http://mgimond.github.io/ES218/Data/ABC.rds"))) exception : con has not defined. what type of connection it requires? 回答1: If you are having issues one way is to download the file as a tempfile. url <- "mgimond.github.io/ES218/Data/ACS.rds" temp <- tempfile() # create a tempfile download.file(url, temp) #

Python bokeh slider not refreshing plot

杀马特。学长 韩版系。学妹 提交于 2020-05-18 01:47:05
问题 I am creating a bokeh plot with a slider to refresh plot accordingly. There are 2 issues with the code posted. 1. The plot is not refreshed as per the slider. Please help in providing a fix for this issue. 2. Plot is not displayed with curdoc() when bokeh serve --show fn.ipynb is used I'm trying to visualise this CSV file. import pandas as pd import numpy as np from bokeh.models import ColumnDataSource, CategoricalColorMapper, HoverTool, Slider from bokeh.plotting import figure, curdoc from

Simple model error on fit: Found input variables with inconsistent numbers of samples

一笑奈何 提交于 2020-05-17 08:52:08
问题 I know this question exists in various forms, but after searching the web for several days/hours, I still havent found anything, that solved my problem. This is my notebook: import numpy as np import pandas as pd X = pd.read_csv('../input/web-traffic-time-series-forecasting/train_1.csv.zip') X = X.drop('Page', axis=1) X.fillna(0, inplace=True, axis=0) X_sliced = X.iloc[:, 0:367] y_sliced = X.iloc[:, 367:-1] from sklearn.linear_model import LinearRegression from sklearn.model_selection import

Pandas unable to filter rows by quarter in specific year

拈花ヽ惹草 提交于 2020-05-17 06:01:34
问题 I have a dataset like below- Store Date Weekly_Sales 0 1 2010-05-02 1643690.90 1 1 2010-12-02 1641957.44 2 1 2010-02-19 1611968.17 3 1 2010-02-26 1409727.59 4 1 2010-05-03 1554806.68 It has 100 stores in all. I want to filter the data of the year 2012 by Quarter # Filter out only the data in 2012 from the dataset import datetime as dt df['Date'] = pd.to_datetime(df['Date']) ds_2012 = df[df['Date'].dt.year == 2012] # Calculate Q on the dataset ds_2012 = ds_2012.sort_values(['Date'],ascending

Plotly missing orca

五迷三道 提交于 2020-05-13 14:11:37
问题 I have small problem when exporting static chart using plotly. Plotly does not correctly recognize that I have orca installed and I have still error related to missing orca. I try to change the orca directory but it is still not working. Anyone who knows what is wrong? My code: import plotly.graph_objects as go import orca import plotly #%% fig = go.Figure(data=go.Candlestick(x=pricedata.index, open=pricedata['bidopen'], high=pricedata['bidhigh'], low=pricedata['bidlow'], close=pricedata[

Using sample_weight in Keras for sequence labelling

倖福魔咒の 提交于 2020-05-09 19:25:58
问题 I am working on a sequential labeling problem with unbalanced classes and I would like to use sample_weight to resolve the unbalance issue. Basically if I train the model for about 10 epochs, I get great results. If I train for more epochs, val_loss keeps dropping, but I get worse results. I'm guessing the model just detects more of the dominant class to the detriment of the smaller classes. The model has two inputs, for word embeddings and character embeddings, and the input is one of 7

Using sample_weight in Keras for sequence labelling

旧巷老猫 提交于 2020-05-09 19:25:08
问题 I am working on a sequential labeling problem with unbalanced classes and I would like to use sample_weight to resolve the unbalance issue. Basically if I train the model for about 10 epochs, I get great results. If I train for more epochs, val_loss keeps dropping, but I get worse results. I'm guessing the model just detects more of the dominant class to the detriment of the smaller classes. The model has two inputs, for word embeddings and character embeddings, and the input is one of 7

What does the standard Keras model output mean? What is epoch and loss in Keras?

て烟熏妆下的殇ゞ 提交于 2020-05-07 10:14:12
问题 I have just built my first model using Keras and this is the output. It looks like the standard output you get after building any Keras artificial neural network. Even after looking in the documentation, I do not fully understand what the epoch is and what the loss is which is printed in the output. What is epoch and loss in Keras? (I know it's probably an extremely basic question, but I couldn't seem to locate the answer online, and if the answer is really that hard to glean from the

poor accuracy score on classfication problem [closed]

醉酒当歌 提交于 2020-05-01 09:50:26
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 8 days ago . I'm trying to build a classification model and my target is not binary . The correlations of my features against my target are all weak (mostly 0.1). I have preprocessed my data and applied the all the algorithms i used to it (the algorithms i used are svm, knn, naivebayes,logistic

poor accuracy score on classfication problem [closed]

岁酱吖の 提交于 2020-05-01 09:49:32
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 8 days ago . I'm trying to build a classification model and my target is not binary . The correlations of my features against my target are all weak (mostly 0.1). I have preprocessed my data and applied the all the algorithms i used to it (the algorithms i used are svm, knn, naivebayes,logistic