Predicting sparse time series data

I have a dataset of a couple of EV charging stations (10 min frequency) over 1 year. This data consists of lots of 0s, since there is no continuous flow of cars coming to charge, but rather reoccurring charging events as peaks (for example from 7-9am seems to be a frequent charging timeframe when people are coming to the office). I have also aggregated weather and weekday/holiday data to be used as features. I now wish to predict the energy …
Category: Data Science

Hide custom fields by user's role

I've tried reading all the questions about this topic, and configured the code to fit my needs, but can't seem to get it to work. This is the code I have now: function my_exclude_custom_fields( $protected, $meta_key, $user ) { $user = wp_get_current_user(); if ( in_array( 'udlejer', (array) $user->roles ) ) { if ( in_array( $meta_key, array( 'email', 'text' ) ) ) { return true; } } return $protected; } add_filter( 'is_protected_meta', 'my_exclude_custom_fields', 10, 2 ); It doesn't make any change. …
Category: Web

How do I include and iframe in a Custom Block?

Given the html block tag I can include and iframe from Google My Maps in my post. I need to create a block where the client can paste the URL from the embed code and the block render the iframe. note: "embed code" does not mean using the embed tag, but that is what the iframe code is called to embed the map on a web page. I have attempted with Genesis Custom Blocks but it will not render the …
Category: Web

Customize menu link for taxonomy in WP menu

I have a Taxonomy that I would like to change the link to in the WP menu. When clicking it goes to the Add Taxonomy page, like normal. What I would like to do is navigate to the Edit Page. In other words, the taxonomy navigates to edit-tags.php (as expected) /wp-admin/edit-tags.php?taxonomy=news_archive_options&post_type=news What I'd like to do is navigate to the term.php page /wp-admin/term.php?taxonomy=news_archive_options&tag_ID=10&post_type=news Thanks!
Category: Web

Which algorithm can be used to reduce dimension of multiple time series?

In my dataset, a data point is essentially a Time series of 6 feature over a year per month so in all, it results in 6*12=72 features. I need to find class outliers so I perform dimensionality reduction hoping the difference in data is maintained and then apply k-means clustering and compute distance. For dimensionality reduction I have tried PCA and simple autoencoder to reduce dimension from 72 to 6 but results are unsatisfactory. Can anyone please suggest any other …
Category: Data Science

Exclude subscriber users from user list

I want to exclude Subscribers from a user list. My code is: $users = $wpdb->get_results( "SELECT display_name FROM $wpdb->users ORDER BY display_name ASC" ); How can I change that so subscribers are excluded from the list? I also looked at the get_users function in codex but it did not have an exclude by role parameter. Edit: Or another way would be to get the results filtered by capability (one that subscribers doesn't have).
Category: Web

calculating gradient descent

when using mini batch gradient descent , we perform backpropagation after each batch , ie we calculate the gradient after each batch , we also capture y-hat after each sample in the batch and finally calculate the loss function all over the batch , we use this latter to calculate the gradient, correct ? now as the chainrule states we calculate the gradient this way for the below neural network: the question is if we calculate the gradient after passing …
Category: Data Science

Regression problem with Deep Learning

I'm working on the Housing Price dataset, where the target is to predict the housing price. The price of the house will always be positive and according to me, it's possible that the model can predict a negative outcome for some of the samples. If it's correct, is there any way to control the training such that the model always predicts at least the positive value. As in the case of the classification case we use the Sigmoid/Softmax activation function …
Category: Data Science

`wp_set_script_translations` with `wp.i18n` does not return translated strings in simple plugin

Short description: I try to translate strings in JS file. To test it I decided to create a simple test plugin. I have PHP and JS strings there. Translated PHP strings work fine, JS strings don't work. Tools and environment: WP-CLI 2.4.0 Wordpress 5.5.1 Ubuntu 20.04 Original languange: English (United States) Translate language: German Plugin PHP file content: <?php /* * Plugin Name: Test * Text Domain: test * Domain Path: /languages */ /** * Init all */ function run() …
Category: Web

Which model is better able to understand the difference that two sentences are talking about different things?

I'm currently working on the task of measuring semantic proximity between sentences. I use fasttext train _unsiupervised (skipgram) for this. I extract the sentence embeddings and then measure the cosine similarity between them. however, I ran into the following problem: cosine similarity between embeddings of these sentences: "Create a documentation of product A"; "he is creating a documentation of product B" is very high (>0.9). obviously it because both of them is about creating a documentation. but however the first …
Category: Data Science

Expected performance of training tf.keras.Sequential model with model.fit, model.fit_generator and model.train_on_batch

I am using Keras with Tensorflow backend to train a simple 1D CNN to detect specific events from sensor data. While the data with tens of millions samples easily fits to the ram in the form of an 1D float array, it obviously takes a huge amount of memory to store the data as a N x inputDim array that can be passed to model.fit for training. While I can use model.fit_generator or model.train_on_batch to generate the required mini batches …
Category: Data Science

How to show posts only for the last subcategory?

I have a hierarchical categories tree, meaning up to 3-4 subcategories with posts. When clicking on a category link in the home page, I am redirected to the category page. I need to check if there are no subcategories for the current category, then show posts, BUT if there are subcategories, then show only subcategories titles and descriptions with no posts at all. Next, if I click on a subcategory title, check again if there are child categories to that …
Category: Web

Keras loss object and shapes

I'm at a loss. I've been staring at this problem for a while and I'm unsure how to proceed. I've been constructing a script to train a model for object detection based on a dataset I've compiled. I've been going along with some example scripts and modifying some code. Here is my code: import os from tempfile import gettempdir import tensorflow as tf from tensorflow.keras import layers, Model, Sequential import numpy as np from clearml import Task, Dataset, TaskTypes def …
Category: Data Science

Display Custom Column in CPT Taxonomy

I am trying to add a column to one of my custom post types, but only on the edit taxonomy page. I have a taxonomy registered called "event-categories" for my custom post type "events". I can successfully add the custom column to the custom post type edit screen, but can't seem to get the hook to work on the edit taxonomy page. Digging through some of the core, I was able to locate the hook $taxonomies = apply_filters( "manage_taxonomies_for_{$post_type}_columns", $taxonomies, …
Category: Web

Column sum in SPSS (with filter and grouped by date)?

device date act power 1 react power 2 ------------------------------------------------- M1 05-02 2 3 M2 05-02 4 2 M3 05-02 3 4 M1 06-02 1 2 M2 07-02 3 4 ------- ------- need sum need sum Say that I only need the sum of M1 and M2 from that table. How could I add a variable that contains the sum of power group by date and device? I don't know if it is desired to have something like this? Or how …
Category: Data Science

Time Series Data Noise Handling Questions

There are manufacturing time series data as shown in the picture. The average of the two variables is about 100. However, the noise value is 6500 and 65000, which is too different from other values. I think those are data collection errors or misrecorded noise. I want to process those values and analyze the time series, is there any way? I want to use expert domain knowledge to scope and remove it, but it is difficult to meet an expert.
Category: Data Science

WordPress - List Sub Categories and Sub-Sub Categories, With Posts

I have the following code. It allows me to show sub categories and documents within them. The thing is, a sub category may contain further sub categories. The code below will show documents belonging to a sub-sub (grand child) category at sub (parent) level. Please can anyone shed light on how to solve this so document only show underneath the category they are directly under? In addition, highlighting what is a sub-sub (grandchild) category as well? All posts titles should …
Category: Web

faster alternatives to sparse.model.matrix?

I have a large dataset that is entirely categorical. I'm trying to train with it using xgboost, so I must first convert this categorical data to numerical. So far I've been using sparse.model.matrix() in the Matrix library but it is far too slow. I found a great solution here, however, the sparse matrix it returns in not the same one that sparse.model.matrix returns. I know there is a way to force sparse.model.matrix to return identical output as the solution in …
Category: Data Science

KNN improvements (python)

I rencently had to work on a problem where the best baseline was knn (geolocalised data). I have different targets (binary classification, multiclass classification and regression) and associated metrics, so I use inddiferently knn for classification or regression. This Baseline was easy to implement in Python (sklearn). I was wondering how to improve the baseline. I tried tuning the knn hyperparameters. Optimising k worked a bit, modifying distances didn't work (natural L2 distance worked best by far). Others models gave …
Category: Data Science

Could Attention_mask in T5 be a float in [0,1]?

I was inspecting T5 model from hf https://huggingface.co/docs/transformers/model_doc/t5 . attention_mask is presented as attention_mask (torch.FloatTensor of shape (batch_size, sequence_length), optional) — Mask to avoid performing attention on padding token indices. Mask values selected in [0, 1]: 1 for tokens that are not masked, 0 for tokens that are masked. I was wondering whether it could be used something "softer" not only selecting the not-padding token but also selecting "how much" attention should be used on every token. This question is …
Category: Data Science

Perform clustering from a similarity matrix

I have a list of songs for each of which I have extracted a feature vector. I calculated a similarity score between each vector and stored this in a similarity matrix. I would like to cluster the songs based on this similarity matrix to attempt to identify clusters or sort of genres. I have used the networkx package to create a force-directed graph from the similarity matrix, using the spring layout. Then I used KMeans clustering on the position of …
Category: Data Science

Can I create a not clickable post?

My landing page is displaying all posts that have been posted so far. On special occasions (e.g. holidays) I want to post a gif or picture and only a few words (e.g Happy holidays!) which is not clickable. There will be no further text, so I don't need this kind of post to get me to another page. Is there any way to achieve this? I would really appreciate your help.
Category: Web

Blog post is redirecting to home page

It wasn't doing this before, and I'm not sure what has caused this to change. I have tried: clearing cache changing permalink structure, saving, and setting back again unpublishing and republishing So far nothing has worked. The blog post shows up on the /blog page, however when I click on the 'read more' link, it redirects to the home page. If I try navigating directly, it will also navigate to the home page.
Category: Web

What are the requirements for a word list to be used for Bayesian inference?

Intro I need an input file of 5 letter English words to train my Bayesian model to infer the stochastic dependency between each position. For instance, is the probability of a letter at the position 5 dependent on the probability of a letter at position 1 etc. At the end of the day, I want to train this Bayesian network in order to be able to solve the Wordle game. What is Wordle? It’s a game where you guess 5 …
Category: Data Science

How does Pandas store timezone information?

Timestamp columns are stored internally in UTC, regardless of whether they have a timezone or not. This is stated in the docs: https://pandas.pydata.org/docs/user_guide/timeseries.html#working-with-time-zones So how is timezone information stored internally? There must be some sort of "tag" which makes that column contain pd.Timestamp entries with tz="America/New_York" or whatever the timezone is. Context: I am writing data to disk in a way that is not specific to Python, e.g I am not using pickle. When I retrieve the data I want …
Topic: pandas python
Category: Data Science

Linear Discriminant - Least Squares Classification Bishop 4.1.3

Pls. refer section 4.1.3 in Pattern Recognition - Bishop: "Least squares for Classification": In a 2 class Linear Discriminat system, we classified vector $\mathbf{x}$ as $\mathcal{C}_1$ if y($\bf{x}$)>0, and $\mathcal{C}_2$ otherwise. Generalizing in section 4.1.3, we define $\mathcal{K}$ linear discriminant equations - one for each class: $y_{k}(\bf{x}) = \bf{w_k^Tx} + \mathit{w_{k0}} \tag {4.13}$ adding a leading 1 to vector $\bf{x}$ yields $\tilde{\mathbf{x}}$. And the Linear Discriminant function for $\mathcal{K}$ class is given by: $\bf y(x) = \widetilde{W}^{T}\tilde{x}$. The author progresses …
Category: Data Science

Related post without plugin for custom post types

I need some help modifying this script. I am trying to also show related posts by custom taxonomies and custom post types. //* Define custom image size for featured image in Related Posts add_image_size( 'related', 300, 0, true ); add_action( 'genesis_after_entry_content', 'child_related_posts' ); /** * Outputs related posts with thumbnail * * @author Nick the Geek * @url http://designsbynickthegeek.com/tutorials/related-posts-genesis * @global object $post */ function child_related_posts() { if ( is_singular ( ) ) { global $post; $count = 0; $postIDs …
Category: Web

confidence interval around standardised regression coefficient?

I have computed a simple linear regression model as below, but am confused as to whether the confint() function is sufficient to provide 95% confidence intervals around the standardised regression coefficient in the linear model (beta)? Has anyone else run into this issue or is confint() sufficient to extract the 95% confidence interval (i.e., +/-1.96 standard errors of the standardised regression coefficient)? h1a <- lm(formula = var1~ var2, data = df) # estimate value of intercept (b0) and slope (b1) …
Category: Data Science

Rest API encoding of double quotes

I have a standard rest API setup in WP. The results are displayed in an IOS App. Now the problem occurres, that single and double quotes and & are returned in the JSON as Unicode Decimal Code: eg. &#8216. All other characters seem fine. Any Ideas to that?
Category: Web

Overfitting problem: high accurance and low accurancy validation for image classification

I want to define a model to predict 3 categories of images. I'm learnong on the field :-) I've 1500 images (500 for each category) in 3 directories. I've read in this blog many suggestions: use a simple loss function use droput use shuffle I've applied these tricks but the model still overfits ... This is the code I'm using, any suggestion? dim_x = 500 dim_y = 200 dim_kernel = (3,3) data_gen = ImageDataGenerator(rescale=1/255,validation_split=0.3) data_dir = image_path train_data_generator=data_gen.flow_from_directory( data_dir, target_size=(dim_x,dim_y), …
Category: Data Science

Use of undefined constant FS_CHMOD_DIR - assumed 'FS_CHMOD_DIR'

I'm seeing an error while trying to change the colours of a theme: Notice: Use of undefined constant FS_CHMOD_DIR - assumed 'FS_CHMOD_DIR' in /var/www/vhosts/xxx/wp-content/themes/consulting/inc/print_styles.php on line 141 The theme creator has given me the following advice, but cannot provide any further detail: Please contact your hosting provider team and ask to enable (set up) PHP FILE extension in your site. It will solve the problem. I manage my server, but I have also been in contact with my hosting provider, …
Category: Web

Question About Discriminator of CycleGan

The Discriminator of CycleGan outputs not just a single value to say that the image is real or fake.... But It outputs a grid of numbers (like 8X8 or 7x7), where each number says whether one patch of the input image is fake or real. So, my question is that, why do we do this.. What benefits does it gives us, and what was the problem in the approach where we only outputted a single value?
Category: Data Science

About

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