Detecting abundance of a certain periodic pattern in a time series?

I am really stumped at the moment about how to solve a particular problem. I have many time series like this: This represents the number of hours a person spends on a website each day throughout the year. Any days where they are not seen to be using the website have zero values, rather than missing values. What I really want to do is to calculate a metric telling me to what extent there is a consistent "1 hour per …
Category: Data Science

Uncaught Error: Call to undefined function mysql_connect() - Wordpress installation

Trying to install wordpress without xamp on my local machine. Version info: Wordpress: 5.2.3 PHP: 7.3.9 Apache: 2.4.41 When accessing this url -http://localhost:8080/wordpress/wp-admin/install.php, I see the following in wordpress logs: [16-Sep-2019 18:47:34 UTC] PHP Fatal error: Uncaught Error: Call to undefined function mysql_connect() in C:\apps\httpd-2.4.41-win64- VS16\Apache24\htdocs\wordpress\wp-includes\wp-db.php:1643 I tried the solutions available online but I still see the error. Solutions I tried so far: Add the following to my wp-config.php: define( 'WP_USE_EXT_MYSQL', true); Added following to php.ini: extension_dir = "ext" extension=php_mysqli.dll …
Category: Web

Whether to use LDA or QDA

I'm trying to determine whether it's best to use linear or quadratic discriminant analysis for an analysis that I'm working on. It's my understanding that one of the motivations for using QDA over LDA is that it deals better with circumstances in which the variance of the predictors is not constant across the classes being predicted. This is true for my data, however I intend to carry out principal components analysis beforehand. Because this PCA will involve scaling/normalising the variables, …
Category: Data Science

Exact Shap calculations for logistic regression?

Given the relatively simple form of the model of standard logistic regression. I was wondering if there is an exact calculation of shap values for logistic regressions. To be clear I am looking for a closed formula depending on features ($X_i$) and coefficients ($\beta_i$) to calculate Shapley values and their corresponding importance.
Category: Data Science

How to train ML model for time series data

I am trying to build a machine learning model in python. I used pytorch and sklearn to make the model. My model is a bit complicated: I have between one to 8 input feature but several target variables. My target variables are kind of time series. Shape of my taget variable is 50x169 but my input feature the shape is between 50x1 to 50x8. I showed three different series in the upladed figure. I used algorithms like DecisionTreeRegressor and RandomeForestRegressor …
Category: Data Science

Filter post by current 2 differents users id

I'm filtering my custom post type based on author. I want all users to be able to: 1 - in the list everyone can see the posts created by the admin. 2 - users can also see their own posts in the list, but not those of other users. I can list by admin id only or current user id only, but not both. Code: function list_cpt_by_author_id(){ $user = new WP_User(get_current_user_id()); $authors_id = array( array('author' => "1"), array('author' => "$user"), …
Category: Web

massively imbalanced data

I am dealing with time series data with +200K (every minute for 6 months)record of gas turbine I am trying to early detect the fault (0 or 1-fault). The issues with the data are: 1.the fault occurred only 5 times (by observing the sudden shutdown). make the data hugely imbalanced. 2.(unsupervised) No binary output. I used 2 of the variables as my output and used them for binary clustering (kmeans) but the result not very good as there are false …
Category: Data Science

wordpress fcm plugin not working on scheduled posts correctly

I am very new to wordpress/php, I don't fully understand it yet. So I've implemented firebase cloud messaging in a wordpress app and I am able to send push notifications with "FCM Push Notification from WP" plugin, and it also works with scheduled posts IF the admin panel is open when the scheduled post is due. Otherwise it will send the notification when I browse to the admin panel. I really don't understand this code fully, but what could I …
Category: Web

Filter "get_terms" query

I'm currently getting the data from a custom taxonomy using this: $terms = get_terms(array( 'taxonomy' => 'my_custom_taxonomy_name', 'hide_empty' => true )); Now, this returns a lot of stuff in each WP_Term object; term_id, name, slug, term_group, term_taxonomy_id, taxonomy, description, parent, count and filter. I only need to get 2 of those: name and slug. How can I filter that query so it doesn't returns all that unused data?
Category: Web

Dealing with missing data in SVD

I am a newbie to machine learning and I am trying to apply the SVD on the movielens dataset for movie recommendation. I have a movie-user matrix where the row is the user id, the column is the movie id and the value is the rating. Now, I would like to perform normalization on the movie-user matrix (subtract the data by users ratings mean). Then pass the normalized matrix to Scipy.sparse svds as follow: from scipy.sparse.linalg import svds U, sigma, …
Category: Data Science

Add Product categories to Wordpress menu without losing hierarchy

I need to add product categories to Wordpress menu, but when I'm doing this with WP interface it lose the hierarchy I tried with WP-CLI, but there is no method to specify wich item is the child. There is a method to do it? There is a ton of categories (3-4 level deep), I cannot do this manually I can buy also a plugin. Can you suggest something? Thanks a lot
Category: Web

Sort on meta value but include posts that don't have one

I've been modifying the built in WP search using the pre_get_posts filter, allowing the user to sort the posts (including a bunch of custom post types) by different fields. The problem I'm having though is that when I tell WP to sort by a meta value it will exclude all posts that don't have that meta value set. This causes the number of results to change if you change sorting from say "Price" to "Date" because "Posts" don't have "Price" …
Category: Web

Verifying my understanding of MLE & Gradient Descent in Logistic Regression

Here is my understanding of the relation between MLE & Gradient Descent in Logistic Regression. Please correct me if I'm wrong: 1) MLE estimates optimal parameters by taking the partial derivative of the log-likelihood function wrt. each parameter & equating it to 0. Gradient Descent just like MLE gives us the optimal parameters by taking the partial derivative of the loss function wrt. each parameter. GD also uses hyperparameters like learning rate & step size in the process of obtaining …
Category: Data Science

What is the purpose of Sequence Length parameter in RNN (specifically on PyTorch)?

I am trying to understand RNN. I got a good sense of how it works on theory. But then on PyTorch you have two extra dimensions to your input data: batch size (number of batches) and sequence length. The model I am working on is a simple one to one model: it takes in a letter than estimates the following letter. The model is provided here. First please correct me if I am wrong about the following: Batch size is …
Topic: pytorch lstm rnn
Category: Data Science

CSS not showing up in my website Only HTML Displaying

I am very new to wordpress. I installed it on my linux server lately and uploaded a them on it. Everything looks good on my browser however if I try to access the website outside my network I am only getting the Text and not the CSS. I have read all different forum for the fix bt my problem still there. Here is my .htaccess # BEGIN WordPress <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} …
Category: Web

Reinforcement Learning : Why acting greedily with the optimal value function gives you the optimal policy?

The course of David Silver about Reinforcement Learning explains how you get the optimal policy from the optimal value function. It seems to be very simple, you just have to act greedily, by maximizing at each step the value function. In the case of a small grid world, once you have applied the Policy Evaluation algorithm, you get for example the following matrix for the value function : You start from the up-left corner and the unique actions are the …
Category: Data Science

How to add image uploader to a custom widget?

I'v built a custom widget that will show some sport scores. Scores are added trough custom post. When i open new custom post(scores) i enter their team names, score, scores. Now i want to add an option to show team logos next to the team name. In the last couple of days every tutorial here and elsewhere i could find didnt worked. I have no idea why, as i am newbie with all this. With many of it, upload button …
Category: Web

unsupervised anomaly detection for univariate fast frequency time series data?

I have a univariate time series (there is a value for each time sampling) (sampling time: 66.66 micro second, number of samples/sampling time=151) coming from a scala customer This time series contains some time frame which each of them are 8K (frequencies)*151 (time samples) in 0.5 sec [overall 1.2288 millions samples per half a second) I need to find anomalous based on different rows (frequencies) Report the rows (frequencies) which are anomalous? (an unsupervised learning method) Do you have an …
Category: Data Science

How to restore visual editor in WordPress

I am running WP Multisite in version 4.8 I have a site in the network that lost the visual editor toolbar a ways back (not exactly sure when it disappeared). When you go to Text view mode the content and markup is entirely visible. When you go to Visual view mode the content is there but white text on white background. Plus, the visual editor toolbar is missing all together. I am running 18 plugins on this site -- none …
Category: Web

How to measure multi-label multi-class accuracy

I have a model that has multi-label multi-class targets Example Age Height Weight Mark Distance Red Yellow Green Blue Black White 14 160 62 78 103 0 1 1 1 1 0 56 177 90 99 363 1 1 0 0 0 0 32 179 79 83 737 0 0 0 0 1 0 17 180 94 75 360 1 0 1 1 1 1 43 186 102 51 525 0 0 0 0 0 0 55 168 74 48 …
Category: Data Science

using media_sideload_image with a file from theme directory

I'm building a Wordpress site in which an admin can upload a video file from post metabox. After that post is saved and the video file is attached to the post, I used ffmpeg to get the screenshot at the first second of video, then save this screenshot as a JPG file in 'tmp' directory in theme directory. Finally, I want to programmatically make this screenshot as post featured image. I use media_sideload_image function, which generally be used to get …
Category: Web

Display Post Featured Image along with Categories via WP Rest API

I have a custom function that pulls in (3) posts from another Wordpress blog, and it's pulling them from specific categories I specify via a shortcode. Now, with that said, I cannot get it to function and display the actual image, as I can only get it to show the featured Image's (media attachment's) ID itself. Here is my functional code, which works except the image is not displayed, instead it's the images ID (numerical value) function feedpuller_func($atts) { $url …
Category: Web

model.fit vs model.evaluate gives different results?

The following is a small snippet of the code, but I'm trying to understand the results of model.fit with train and test dataset vs the model.evaluate results. I'm not sure if they do not match up or if I'm not understanding how to read the results? batch_size = 16 img_height = 127 img_width = 127 channel = 3 #RGB train_dataset = image_dataset_from_directory(Train_data_dir, shuffle=True, batch_size=batch_size, image_size=(img_height, img_width), class_names = class_names) ##Transfer learning code from mobilenetV2/imagenet here to create model initial_epochs = …
Category: Data Science

How does ExtraTrees (Extremely Randomized Trees) learn?

I'm trying to understand the difference between random forests and extremely randomized trees (https://orbi.uliege.be/bitstream/2268/9357/1/geurts-mlj-advance.pdf) I understand that extratrees uses random splits and no bootstrapping, as covered here: https://stackoverflow.com/questions/22409855/randomforestclassifier-vs-extratreesclassifier-in-scikit-learn The question I'm struggling with is, if all the splits are randomized, how does a extremely randomized decision tree learn anything about the objective function? Where is the 'optimization' step?
Category: Data Science

Finding data with transformation applied

Is there a way to find relatedness between data and the data obtained after some transformation applied to it? i.e. given a data I need to find the most related data(most of the values in that data can be obtained) that can be found by applying some transformation in original data. I tried but couldn't find a proper answer, most of the discussion that I found is about linear transformation or log transformation but I want to find a way …
Category: Data Science

Trying to deque some .js from source

that is my source: view-source:buhehe.de i am trying to deque some script form function.php i mean these two: <script type="text/javascript" src="http://buhehe.de/wp-content/themes/tema/js/jquery-3.2.1.min.js"></script> <script type='text/javascript' src='http://buhehe.de/wp-includes/js/jquery/jquery.js?ver=1.12.4'></script> I added following code in Function.php but it doesn't deques scripts from source: function dequeue_script() { wp_dequeue_script( 'http://buhehe.de/wp-content/themes/heatt/js/small-menu.js?ver=4.9.1' ); wp_dequeue_script( 'http://buhehe.de/wp-includes/js/wp-embed.min.js?ver=4.9.1' ); wp_dequeue_script( 'http://buhehe.de/wp-includes/js/wp-embed.min.js' ); } add_action( 'wp_print_scripts', 'dequeue_script', 100 ); How can i deque these scripts fcrom source?
Category: Web

Incorporating structural information in a Transformer?

For a Neural Machine Translation (NMT) task, my input data has relational information. This relation could be modelled using a graphical structure. So one approach could be to use Graph Neural Network (GNN) and use a Graph2Seq model. But I can't find a good generational model for GNN. Instead, I want to use Transformer. But then the challenge is how can I embed structural information there? Is there any open source artefact for Relational Transformer that I can use out …
Category: Data Science

Derivative of MSE Cost Function

The gradient descent: $\theta_{t+1}=\theta_t-a\frac{\partial}{\partial \theta_j}J(\theta)$ But specifically about $J$ cost function (Mean Squared Error) partial derivative: Consider that: $h_\theta(x)=\theta_0+\theta_1x$ $\frac{\partial}{\partial\theta_j}J(\theta) = \frac{\partial}{\partial\theta_j}\frac{1}{2}(h_{\theta}(x)-y)^2$ $\ \ \ \ \ \ \ \ \ \ \ \ =2\frac{1}{2}(h_{\theta}(x)-y)*\frac{\partial}{\partial\theta_j}(h_{\theta}(x)-y)$ $\ \ \ \ \ \ \ \ \ \ \ \ = (h_{\theta}(x)-y)*\frac{\partial}{\partial\theta_j}(\sum_{i=0}^{n}\theta_ix_i-y_i)$ $\ \ \ \ \ \ \ \ \ \ \ \ = (h_{\theta}(x)-y)x_j$ It´s not clear to me how $x_j$ is calculated: $\frac{\partial}{\partial\theta_j}(\sum_{i=0}^{n}\theta_ix_i-y) = x_j $ Can anyone help me …
Category: Data Science

What's the order in applying SMOTE transformation in a pipeline?

Here's the thing, I have an imbalanced data and I was thinking about using SMOTE transformation. However, when doing that using a sklearn pipeline, I get an error because of missing values. This is my code: from sklearn.pipeline import Pipeline # SELECAO DE VARIAVEIS categorical_features = [ "MARRIED", "RACE" ] continuous_features = [ "AGE", "SALARY" ] features = [ "MARRIED", "RACE", "AGE", "SALARY" ] # PIPELINE continuous_transformer = Pipeline( steps=[ ("imputer", SimpleImputer(strategy="most_frequent")), ("scaler", StandardScaler()), ] ) categorical_transformer = Pipeline( steps=[ …
Category: Data Science

ShortCode and extra </p>

[box id='1' text="some texte"] the shortcode, at one point is outputting text the html result is : &lt;/p&gt; some text &lt;/p&gt; There is an extra closing paragraph in the start and and opening at the end... WHY ? where those come from ?.... any idea ?.. it screw my w3 validation ! ** note i have found that... but look all "patched" to me...any clean solution... wp is dirty ? reference
Category: Web

ABSPATH not working! Any idea why?

This is what in my wp-config.php : if ( !defined('ABSPATH') ) define('ABSPATH', dirname(__FILE__) . '/'); I am calling from plugin/pluginName directory to : require_once( ABSPATH . 'wp-includes/user.php'); But it is returning: Warning: require_once(ABSPATHwp-includes/user.php) [function.require-once]: failed to open stream: No such file or directory in /home/------/wp-content/plugins/---/---.php on line 43 Fatal error: require_once() [function.require]: Failed opening required 'ABSPATHwp-includes/user.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/------/wp-content/plugins/---/---.php on line 43 Any idea why I am having this error? Any solution? Thanks.
Category: Web

wp_mail() not sending emails with ajax

I am using wp_mail() to send email using ajax. My mail code is as follow. add_action( 'wp_ajax_send_confirmation_email', 'wpse_sendmail' ); add_action( 'wp_ajax_nopriv_send_confirmation_email', 'wpse_sendmail' ); function wpse_sendmail() { if(isset($_GET['is_email']) &amp;&amp; $_GET['is_email'] == true){ $temp_dir = get_template_directory_uri(); $url = $temp_dir."/confirm_email.php?id=".$_REQUEST['id']."&amp;key=".$_REQUEST['key']; $message = "Username:".$_REQUEST['name']."Click on below link to confirm your email;".$url; $subject = "Email confirmation Link"; $headers = "From: [email protected]" . "\r\n"; if ( wp_mail( $_REQUEST['email'], $subject, $message, $headers ) ) { echo "1"; } else { echo "0"; } } } And AJAX …
Category: Web

Input standartization for Deep Learning - Proper Scaling

Typically the input to neural network (NN) is transformed to have zero mean and 1 std. I wonder why std scale should be 1? What about other scales? 10? 100? Doesn't it make sense to provide NN with input of wider range so that NN can separate different clusters easier and deal with loss function for each cluster in more simple and robust way? Did someone here tried different scales and can share his experience? If answer depends on 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.