Neural network is not giving the expected output after training in Python

My neural network is not giving the expected output after training in Python. Is there any error in the code? Is there any way to reduce the mean squared error (MSE)? I tried to train (Run the program) the network repeatedly but it is not learning, instead it is giving the same MSE and output. Here is the Data I used: https://drive.google.com/open?id=1GLm87-5E_6YhUIPZ_CtQLV9F9wcGaTj2 Here is my code: #load and evaluate a saved model from numpy import loadtxt from tensorflow.keras.models import load_model …
Category: Data Science

How do I perform Leave One Out Cross Validation For Top n Recommendation Sytems?

I am new in making recommendation systems . I am using the surpriselib library to evaluate my recommendations. All the Accuracy Metrics are well supported in this library. But I also want to compute the Hit Rate of my top n recommender system. I know the formula for hit rate is: (no items users have already purchased)/(no of users) But this does not makes sense to me because to train and test the user vs item ratings I have only …
Category: Data Science

Only Show One Category Name Per Post

I wrote a function to only show a limited number of recent posts per page, and it works fine. But I also want to display only one category-name per post (even if the post has several others), I just want it display the first [0] category from each post. I've spend hours on this and I've gotten very close, but just end up with the posts showing all categories on a list, like when using <?php the_category(" "); ?> I …
Category: Web

Retrive image from from features represented by histograms of oriented gradients

I am using histogram of oriented gradients for image classification using clustering in scikit learn. I am using hog from scikit-image to generate hog from 512x512 grayscale image. Here is an example: fd, hog_image = hog(image, orientations=8, pixels_per_cell=(16, 16), cells_per_block=(1, 1), visualize=True, channel_axis=-1) Where fd is used as features in classification. I wonder if there is a way to retrieve image from fitted coefficients in clustering model, in order to see how features differ between the clusters.(i.e go from fd …
Category: Data Science

How does ALS implementation calculate ratings when model.transform is called?

The spark ALS model is based on this paper: Collaborative Filtering for Implicit Feedback datasets. . Here, latent vectors are learnt such that instead of estimating R (ratings matrix), they only estimate P (preference matrix - binary matrix based on whether user has interacted with item or not). (R is broken down into P and C (confidence matrix). Question: As C is not estimated, how is it possible that model.transform(dataset) accurately predicts ratings R? The implementation is a dead end …
Category: Data Science

WP Search Form Query: Add Author's posts into search query

As the title suggests, I'm looking for WordPress advice relative to leveraging the standard searchform.php functionality to additionally query the author field when performing searches. I've tried various different means to do this without any success, and so I'm coming to quite the headache. Below are the template files used: searchform.php <?php /** * Template for displaying search forms in Twenty Seventeen * * @package WordPress * @subpackage Twenty_Seventeen * @since 1.0 * @version 1.0 */ ?> <?php $unique_id = …
Category: Web

Problem with Author page redirect

When trying to access the author's page (i.e. example.com/author/john) I am redirected to Woocommerce's shop page, however, if john is an admin, then I am redirected to author.php page correctly... any ideas why?
Category: Web

Learnable parameters in DNN

I've come across the term "learnable parameters" recently, and googling didn't help much as most search was describing learnable parameters in a CNN instead of a DNN. Is there any difference between the two? How would I compute the number of learnable parameters in a DNN? Could anyone please explain what those are with an example? I'm new to machine learning so I would appreciate some help on this.
Category: Data Science

How to smooth the Linestring after adding additional point?

Actually I am tracking vessel, where I am already having path, and current position. Now the trouble is, obviously the vessel will not be on same coordinates as provided in the path.So I want to connect the current coordinate with the path and willing get updated path. I have already connected but the issue is with my way the vessel taking long route. Which will be problematic for ETA calculations. Any suggestions? Also the image with map are from website …
Topic: python
Category: Data Science

Data science internship/career problem

I'm a data science student, I'm doing an internship in company X. since I joined the company, no task was assigned directly to me. I was asking my tutor to give me a task so he told me to check the current model and see if I can make it better. I did that in ~2 weeks, I've read the idea behind the model, read his code, coded my approach and added the evaluation. When I finished doing it, I …
Category: Data Science

Cross-validation for anomaly detection on time series data

I want to perform k-fold cross-validation for the setting where I have a training dataset consisting of a sequential time series that is fully benign and a test dataset (also a sequential time series) which contains labeled anomalies. I already took a look at this post, but as my data is sequential, the answer doesn't work out. I am especially stuck with the factor that for K-fold cross-validation, you use (k-1)/k parts of your data for training and 1/k parts …
Category: Data Science

Add sku to product url in WooCommerce

I want to add product SKU to my products url in WooCommerce like this example : example.com/product/sku/productname I checked this topic, but in this method sku will add to end of product name not used as I want : product/sku/productname
Category: Web

Required (mandatory) Gutenberg block

Is there any way to force a Gutenberg block to be on every page of a post type? I tried to add a template on my page and it does almost what I need, but I can still remove my default blocks. The closest I've come is this: function ckt_mina_init_required_block() { // create a new page template (pages only) $page_type_object = get_post_type_object('page'); $page_type_object->template = [ [ 'core/group', [], [ // add a paragraph block for the page summary [ 'core/paragraph', …
Category: Web

Optimizing MAE degrades MAE metrics

I have run a lighgbm regression model by optimizing on RMSE and measuring the performance on RMSE: model = LGBMRegressor(objective="regression", n_estimators=500, n_jobs=8) model.fit(X_train, y_train, eval_metric="rmse", eval_set=[(X_train, y_train), (X_test, y_test)], early_stopping_rounds=20) The model keeps improving during the 500 iterations. Here are the performances I obtain on MAE: MAE on train : 1.080571 MAE on test : 1.258383 But the metric I'm really interested in is MAE, so I decided to optimize it directly (and choose it as the evaluation metric): model …
Category: Data Science

For some time, some of my pages do not display the content anymore. Any idea where this could be coming from?

I recently worked on this website : https://semaine.com/ But since some time the content of the pages https://semaine.com/classroom/ and https://semaine.com/cinema/ are not displayed anymore. The pages load, the navbar and the footer are there but not the content. It works locally on my computer with MAMP but not online. I tried several things like disabling various plugins, re-generating links, restoring the theme from my local version, ... Here is the content of the cinema.php file: <?php /** * Template Name: …
Category: Web

Using a function to change favorites listing

Sorry - total newbie here with Wordpress development. I have the following plugin installed https://favoriteposts.com/ and it allows you to change the default output of the users favorites by using the following function: /** * Customize the Favorites Listing HTML */ add_filter( 'favorites/list/listing/html', 'custom_favorites_listing_html', 10, 4 ); function custom_favorites_listing_html($html, $markup_template, $post_id, $list_options) { return $html; } I just don't know how to use this. What I would like is for the output to match that of the default woocommerce product …
Category: Web

gradient descent diverges extremely

I have manually created a random data set around some mean value and I have tried to use gradient descent linear regression to predict this simple mean value. I have done exactly like in the manual and for some reason my predictor coefficients are going to infinity, even though it worked for another case. Why, in this case, can it not predict a simple 1.4 value? clear all; n=10000; t=1.4; sigma_R = t*0.001; min_value_t = t-sigma_R; max_value_t = t+sigma_R; y_data …
Category: Data Science

Array to string conversion on array_map

I'm using array_map to sort out an array with all of my _octopud_id's. var_dump($offices): Returns the following: array (size=500) 0 => array (size=1) 'id' => string '1382' (length=4) 1 => array (size=1) 'id' => string '1330' (length=4) I need to input that array integer into the 'employees/' section but I can't figure out how - If I hardcode employees/6 I get the following result: object(stdClass)[14592] public 'id' => int 6 What could I be doing wrong? I keep getting the …
Category: Web

Trigger wp-embed via JavaScript to refresh iframe preview?

I'm running WordPress 6.0 and using the Block Editor to enable content editors to paste links that generate the embed/iframe preview, as described here. I've noticed from time to time (i.e. erratically) the embed script doesn't seem to run, and the link remains as static text without converting into the iframe preview. I'm also using Swup.js to handle page transitions throughout the site, and I'm wondering if wp-embed has a method of some kind that I can hook into to …
Category: Web

Extract all data of a month from different years

Ok I had a typo in this question before which I have now corrected: my database (df_e) looks like this: 0,Country,Latitude,Longitude,Altitude,Date,H2,Year,month,dates,a_diffH,H2a 1,IN,28.58,77.2,212,1964-09-15,-57.6,1964,9,1964-09-15,-3.18,-54.42 2,IN,28.58,77.2,212,1963-09-15,-120.0,1963,9,1963-09-15,-3.18,-116.82 3,IN,28.58,77.2,212,1964-05-15,28.2,1964,5,1964-05-15,-3.18,31.38 ... and I would like to save the data from the 9th month from the years 1963 and 1964 into a new df. For this I use the command: df.loc[df_e['H2a'].isin(['1963-09-15', '1964-09-15'])] But the result is Empty DataFrame Columns: [Country, Latitude, Longitude, Altitude, Date, H2, Year, month, dates, a_diffH, H2a] Index: [] Where is my mistake?
Category: Data Science

convert time series data set to supervised for deep learining

I have dataset like so I want to use that for prediction of time series with deep learning. I have this function to make it supervised def to_supervised(train,n_input,n_out): #falten data data=train X,y=list(),list() in_start=0 for _ in range(len(data)): in_end=in_start+ n_input out_end=in_end + n_out if out_end<=len(data): x_input=data[ in_start:in_end,0] x_input=x_input.reshape((len(x_input))) X.append(x_input) y.append(data[in_end:out_end,0]) in_start+=1 return array(X), array(y) I am not sure about functionality of this function. Do you have replacemment for this function?
Topic: dataset
Category: Data Science

Naming Widget Panel and Loading Timing

I use this code to name the Widget Panel. It functions good half the time. The other half of the time the Widget Panel loads too fast it seems and the other sections/panels do not show in customizer. So the only section in customizer is Widget Panel half the time and you need to force refresh page for the customizer to load correctly with all the options displaying. Is there a better code to use to avoid this problem? function …
Category: Web

Dropdown Select Post Filter

I would like to display the posts when I click on an item with the dropdown select Currently, my select is OK, all my terms are displayed and all posts too. I just want to know of it's possible to filter This is my dropdown select : <select name="soins-taxonomy"> <option value="all">Tout afficher</option> <?php // Get the taxonomy's terms $terms = get_terms( array( 'taxonomy' => 'location', 'hide_empty' => false, 'exclude' => 1 ) ); // Check if any term exists if …
Category: Web

How to host your WordPress theme on github and make my theme updatable for my client

I'm currently developing an WordPress theme for a client of mine. I want it to be hosted on GitHub, so my client can update the theme whenever I release a new update of the theme. The problem is that I don't know how to host a theme on GitHub and have a private key saved in the code somewhere, without anyone can see it. Can someone help me out? Thanks in advance!
Category: Web

Could a quadratic function be empolyed instead of a linear one, for piecewise approximation to learn indexes?

It has been evaluated the use of learned piecewise segments in order to create compressed indexes that substitute classical B+-Tree structures, in order to optimize space and have higher query response speed. We propose, instead, that given $S= \{(k_1,1), (k_2,2), \dots, (k_n,n)\}$, to employ a function: $f(k) = a k^2 + b k + c$ where $k\in \mathbb{I}$, is the input key to be searched, and $f(k)$ will give an approximation of the proper index $i$ of $k$. It turns …
Category: Data Science

How to do multivariable regression in Orange3?

Orange3 contains a number of regression widgets, but they all seem to be univariable i.e. one independent variable that correlates to one dependent variable. When I have more independent variables that might influence a dependent variable, how to handle this in Orange3?
Category: Data Science

Change the default video URL in a post to shortcode format

I want to add video from youtube/vimeo to my post.Whenever i add a video to my post ,there will display a link like https://www.youtube.com/watch?v=dsUXAEzaC3Q in my admin(Add new post ),and in the front end it will display the video.But the problem is, i want to show the video like a shortcode example [video url=”https://www.youtube.com/watch?v=dsUXAEzaC3Q”][/video]in the place of original video.That is show the shortcode like above instead of the video in front end.How can it possible.Please help me.
Category: Web

How do I get the divided values of two columns that are a result from a groupby method

I currently have a dataframe that was made by the following example code df.groupby(['col1', 'col2', 'Count'])[['Sum']].agg('sum') which looks like this col1 col2 Count Sum DOG HUSKY 600 1500 CAT CALICO 200 3000 BIRD BLUE JAY 1500 4500 I would like to create a new column which outputs the division of df['Sum'] and df['Count'] The expected data frame would look like this col1 col2 Count Sum Average DOG HUSKY 600 1500 2.5 CAT CALICO 200 3000 15 BIRD BLUE JAY 1500 …
Category: Data Science

how to scraping website data to wordpress taxonomy

i want to scrape data from another website that doesn't provide api to my wordpress site, and i want when i input the data url ($baseTarget) it appears directly in the taxonomy input post_tags, title description, category, image etc in new post. i don't know how to make it, i have searched but haven't found any results. scrape.php <?php namespace App\Services; use voku\helper\HtmlDomParser; class MALService { private $baseTarget = 'https://myanimelist.net'; private function init($path) { $curl = curl_init($this->baseTarget . $path); curl_setopt($curl, …
Category: Web

How to "group" (categorize) the Pages together?

I have a lot of Pages which can be (need to be) grouped under a number of different Categories. ** Then the more important thing is, i need to control those pages (of different groups) programatically via functions.php. Lets say, i would have: Page A (Categorized as: Fruits) Page B (Categorized as: Vehicles) Page C (Categorized as: Vehicles) Page D (Categorized as: Fruits) Page E (Categorized as: Technology) Then from functions.php, there would be some logics, like: If Page is …
Category: Web

Which algorithm to use for transactional data

I'm given a Dataset of transactions and asked to find insights for businesses. I'm extremely new to ML / Data science and have only been experiencing with KMeans. The dataset has the following features merchant ID Transaction date Military time Amount card amount paid merchant name Town area code client ID age band gender code province average income 3 months card value spending card tapped Ignoring NULL data, what type of analysis can I do on this data? I have …
Category: Data Science

How to add Extra Column of post Status in All post page

how can I add an extra admin column with the Status of posts like Below Image. i know admin column plugin for this work but i don't want to use any plugin..so please suggest me if there any code to add an extra admin column with the Post Status
Category: Web

Are more target labels in a multi-label classification always better?

Context We work on medical image segmentation. There are a lot of potential labels for one and the same region we segment. There can be different medically defined labels like anatomical regions, more biological labels like tissue types or spatial labels like left/right. And many labels can be further differentiated into (hierarchical) sub labels. Clarification The question is with respect to the number of classes / target labels which are used in a multi-label classification/segmentation. It is not about the …
Category: Data Science

About

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