Multiple activation functions with TensorFlow estimator DNNClassifier

I just want to know if is it possible to use tf.estimator.DNNClassifier with multiple different activation functions. I mean, could I use a DNNClassifier estimator which use different activation functions for different layers? For example, if I have a three layers model, could I use for the first layer a sigmoid function, for the second one a ReLu function and finally for the last one a tanh function? I would like to know if it isn't possible to do it …
Category: Data Science

a question about activaton function on my neural network project

I want to plement a model of neural network using sckitlearn . and I want to know which activation function should I use ? I have 10 input variable and one output . all variable are floats(positive ). and the Output is a pecentage ( 0 to 100). and my model is note linear to the output variable, so i'll creat regression model with one hidden layer!!
Category: Data Science

Algorythm for the interpolation?

Hi I have now managed to plot various points on a map and interpolate with ordinary kriging. However, my data does not look anything like it should. Do I need to use an algorithm to fill in the missing data? Does anyone know how the RCWIP2 model does this? My data looks like this: and it should look like this: https://www.researchgate.net/figure/Global-mean-annual-average-leaf-water-d-18-O-and-d-2-H-isoscapes-for-the-sites-of_fig1_226462314 Does anyone have an idea where to get an algorythm (open source) for this? Or is it possible to …
Category: Data Science

Changes in the standard Heatmap plot - symmetric bar colors, show only diagonal values, and column names at x,y axis ticks

I have a heatmap image (correlation between all matrix columns) and I'm straggling to preform all the changes below within the same image: bar colors should be symmetric around zero (e.g., correlation of 1 and -1 should be with the same color) change the correlation matrix to a diagonal matrix, since correlation values are symmetric - and show only upper matrix triangle (mask out the lower triangle ) show the correlation values in every cell of the diagonal matrix x,y …
Category: Data Science

Which supervised ML model to use for exam/grade prediction?

So I plan on making a mobile app that will let students predict their final grades based on their mock exam results. I can train my model with previous years results. X: 5 mock results Y: Final grade obtained However, I have the issue that sometimes, or most the times, the user may be using the app whilst not having taken ALL the mock exams yet, they may want to see if they are on track and use it once …
Category: Data Science

Merging two datasets with different features for machine learning prediction

I'm trying to create a model which predicts Real estate prices with xgboost in machine learning, my question is : Can i combine two datasets to do it ? First dataset : 13 features Second dataset : 100 features Thé différence between the two datasets is that the first dataset is Real estate transaction from 2018 to 2021 with features like area , région And the second is also transaction but from 2011 to 2016 but with more features like …
Category: Data Science

Variational AutoEncoder giving negative loss

I'm learning about variational autoencoders and I've implemented a simple example in keras, model summary below. I've copied the loss function from one of Francois Chollet's blog posts and I'm getting really really negative losses. What am I missing here? Model: "model_1" __________________________________________________________________________________________________ Layer (type) Output Shape Param # Connected to ================================================================================================== input_1 (InputLayer) [(None, 224)] 0 __________________________________________________________________________________________________ encoding_flatten (Flatten) (None, 224) 0 input_1[0][0] __________________________________________________________________________________________________ encoding_layer_2 (Dense) (None, 256) 57600 encoding_flatten[0][0] __________________________________________________________________________________________________ encoding_layer_3 (Dense) (None, 128) 32896 encoding_layer_2[0][0] __________________________________________________________________________________________________ encoding_layer_4 …
Category: Data Science

Turning multiple binary columns into categorical (with less columns) with Python Pandas

I want to turn these categories into values of categorical columns. The values in each category are the current binary columns present in the data frame. We have : A11, A12.. is a detail of A1 so if the value in A11 ==1 it will necessarily imply having A1==1 but the inverse is not valid. Respecting the following conditions : maximaum of existing types is 4 if A11==1 value of type1 should be equal to 'A11' and we ignore 'A1' …
Category: Data Science

Naives Bayes Text Classifier Confidence Score

I am experimenting with building a text classifier using Naive Bayes which has been pretty successful on my test data. One thing i am looking to incorporate is handling text that does not fit into any predefined category that I trained the model on. Does anyone have some thoughts on how to do this? I was thinking of trying to calculate the confidence score for each document, and if < 80 % confidence, for example, it should label the data …
Category: Data Science

Clustering time series data using dynamic time warping

I would like to cluster/group the curves in the attached picture with Python. The data is already normalized and my approach would be to use dtw (dynamic time warping) to calculate the distance and with that feature use a clustering algorithm (like kmeans or DBSCAN) to classify them. Do I pick out one trajectory as a starting curve to compare the other curves to, or do I calculate an 'average' curve of all curves and use that as the starting …
Category: Data Science

While using reindex method on any dataframe why do original values go missing?

This is the original Dataframe: What I wanted : I wanted to convert this above data-frame into this multi-indexed column data-frame : I managed to do it by this piece of code : # tols : original dataframe cols = pd.MultiIndex.from_product([['A','B'],['Y','X'] ['P','Q']]) tols.set_axis(cols, axis = 1, inplace = False) What I tried : I tried to do this with the reindex method like this : cols = pd.MultiIndex.from_product([['A','B'],['Y','X'], ['P','Q']]) tols.reindex(cols, axis = 'columns') it resulted in an output like this …
Category: Data Science

What kind of model/type is this

Essentially I want to pass a program some variables, all gathered from a user on my site, and have the program give a "score" of how authentic the user is meant to be. I already have a large set of data with already set "scores" and want to start creating the scores myself ( currently done through a third party) After reading about machine learning and asking some friends I've chosen (still open to ideas) python, but I'm unsure which …
Category: Data Science

How to make a gaussian distribution in python considering mean. variance. skewness and kurtosis?

np.random.normal(mean,sigma,size) allows to create a gaussian distribution based only on mean and variance. I want to create a distribution based on function_name(mean,sigma,skew,kurtosis,size). I tried scipy.stats.gengamma but I don't understand how to use it. It takes 2 parameters - a,c and creates a distribution. But it is difficult to interpret for what values of a & c, the function will give a particular value of skewness and kurtosis. Can anyone explain how to use gengamma or any other way to create …
Category: Data Science

Why I am getting Infinity infity in LineString?

I am try get linestring so I can measure the distance and time. Here in this linestring I am getting nan distance and time. Also, pleased to hear any of your suggestion on my code or logic. Thanks data: [[29.87819, 121.54944999999998], [24.23111845, 119.02311485000001], [5.402576549999999, 106.87891215000002], [1.367889, 104.27658300000002], [4.65750565, 98.40456015000001], [5.93498595, 82.50298040000001], [6.895460999999999, 75.83849285000002], [11.087761, 55.21659015], [11.986111, 50.79761100000002], [12.57124165, 44.563427950000005], [15.262399899999998, 41.828814550000004], [27.339266099999996, 34.20131845], [29.927166, 32.566855000000004], [32.36497615, 28.787162800000004], [36.25582884999999, 14.171143199999989], [37.089583, 11.039139000000006], [36.98901405, 4.773231850000002], [36.139162799999994, -4.182775300000003], [36.86918755, -8.487389949999994], [42.41353785, -9.331828900000005], [47.68888635, …
Topic: python
Category: Data Science

Music Recommander using Implicit Library

I want to build a music recommender predicting the number of times a user will listen to a song. I am using the Implicit library and following this close example : https://github.com/benfred/implicit/blob/main/examples/tutorial_lastfm.ipynb I wanted to know how can I predict the number of plays for a given user for a specific song, all I can see there and in the documentation is to recommend songs to a given user with scores of proximity but without giving the actual prediction
Category: Data Science

test_train_split with stratify integer overflow

I'm trying to do a stratified split for a skewed dataset with target variable 'b'. The target variable is a bit value (either 0 or 1). Here's an example: df = pd.DataFrame(data={'a': np.random.rand(100000), 'b': 0}) df.loc[np.random.randint(0, 100000, 1000), 'b'] = 1 tr, ts = train_test_split(df, test_size=.2, stratify=df['b']) print(tr.shape, ts.shape) This code returns the following: (93105, 2) (38, 2) My problem is that the returned train/test arrays do not meet the set split ratio of 20%. My setup: Python 3.7.0 (32bit) …
Category: Data Science

In a Time Series Problem, is it possible to forecast quantities by learning the patterns of other items? What are my options?

Suppose I own a store that sells a variety of apples and I have the following stats each month. Report Date Type of Apple (TA) Quantity Available(QA) Quantity Sold in the Past 30 days(QS30) Quantity Shipping In (QSI) Quantity Needed to Order(QN) Lets make the following assumptions/givens: There are three types of apples: red apples, green apples and yellow apples. T(1) denotes the first month and T(60) denotes the 60th month. QA @ T(i + 1) = QA@T(i) + QSI@T(i) …
Category: Data Science

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.