Admin: very slow edit page caused by core meta query

We've been noticing really long load times when going to edit a post or page. Using Query Monitor, we found that this WP core query is taking upwards to 15-20s. SELECT meta_key FROM wp_postmeta GROUP BY meta_key HAVING meta_key NOT LIKE '\\_%' ORDER BY meta_key LIMIT 30 caller: meta_form() post_custom_meta_box() do_meta_boxes() We do use a lot of postmeta as one of our post types uses about 20 or so custom fields. I would say maybe we rely too much on …
Category: Web

gravity rising, no airlock activity

fermenting a bochet, I dropped a bluetooth hydrometer in the must and started with a gravity reading of 1.128. Pitched lalvin EC-1118, and over a day the gravity has gone up to 1.144. I've heard that if your yeast is active enough, it can physically push your hydrometer up, and throw your reading off. However, would that not mean that I should have some visible airlock activity? I'm also quite sure my airlock is working properly - the fermenter is …
Category: Mac

SSD based on ResNet-101 doesn't improve over SSD-VGGNet

I am training a SSD model for detecting mobile cranes. The training dataset contains 1,000 images and test set over 400 images. About 200 epochs gave mAP 83%, but my target is 90%. So I trained SSD-ResNet-101 and it gave less accuracy. I assume that it is because ResNet-101 is too deep for the size of my dataset. I consider using ResNet-50 and Inception. But I don't have time to experiment all the models with different parameter settings. Is there …
Category: Data Science

Delete Term via edit-tags.php

I might get rep'ed down on this - but is there suppose to be a "Delete" link on the edit-tags.php page? Note: not the WP-List-Table, but the actual page where you specifically view the terms individually. It seems as if they added on the option here: https://core.trac.wordpress.org/ticket/9777#no1 __ UPDATE It seems like I was looking at the wrong WP file. The individual term page is located at: wp-admin/edit-tag-form.php, and there is no mention of any "Delete". Knowing this, is it …
Category: Web

Model recalibration on different dataset

I have a large dataset approximately 150k rows and 1500 of positive labels on which I can train my model for binary classification. And also I have the other dataset which is smaller and is comprised from 80k rows and 100 positive labels. The problem is that I can't train model on the small dataset because it results in bad quality. And the model trained on the large dataset can provide more stable outcomes for the second case due to …
Category: Data Science

Register users without confirmation

I'm looking to register users without requiring confirmation of their emails (and even better, no password when they register). Basically, I want them to subscribe their mails using wp registration process and then redirect to a page of my choice. I know I can do it with CF7, or a newsletter plugin or whatever, but I actually need to use the default registration process because it connects to another plugin which uses it, and the UX flow is as follows: …
Category: Web

Propensity model with Only Positive Data

Is it possible to build a propensity model (i.e., the likelihood that a user will buy an item) using only positive values. For example, I have a bunch of data about Customers (people that bought stuff) and Users (people that haven't bought stuff yet) I want to get the likelihood that a User becomes a Customer. It seems that the only way to do so is to train a model using the data of Customers, therefore using only Positive values.
Category: Data Science

Predicting value using LSTM

I'm currently learning about LSTM and want to make a prediction using an array as an input and have an output as a single value. I currently trying to do that by using this model: input1 = Input(shape=(2,200,3)) lstm1 = Bidirectional(LSTM(units=32))(input1) dnn_hidden_layer1 = Dense(3, activation='relu')(lstm1) dnn_output = Dense(1, activation='sigmoid')(dnn_hidden_layer1) model = Model(inputs=[input1],outputs=[dnn_output]) model.compile(loss='binary_crossentropy', optimizer='adam', metrics=['accuracy']) model.summary() return model and I got this error Input 0 of layer "bidirectional_1" is incompatible with the layer: expected ndim=3, found ndim=4. Full shape received: …
Category: Data Science

Meaningfully compare target vs observed TPR & FPR

Suppose I have a binary classifier $f$ which acts on an input $x$. Given a threshold $t$, the predicted binary output is defined as: $$ \widehat{y} = \begin{cases} 1, & f(x) \geq t \\ 0, & f(x) < t \end{cases} $$ I then compute the $TPR$ (true positive rate) and $FPR$ (false positive rate) metrics on the hold-out test set (call it $S_1$): $TPR_{S_1} = \Pr(\widehat{y} = 1 | y = 1, S_1)$ $FPR_{S_1} = \Pr(\widehat{y} = 1 | y …
Category: Data Science

Wordpress can't find temporary folder, but folder it's looking at has correct permissions

So, I've spent a couple of hours looking around the internet to try to figure out this problem, since it seems like a dumb one that would probably be a duplicate, but apparently it isn't. I'm hosting a WordPress site in a subdirectory on my main site (http://christopherdumas.org is the main site, http://christopherdumas.org/astraterra is the WP site) and when I try to upload files to a post in the WordPress site, it smacks me with this error: Missing a temporary …
Category: Web

Excel Data to Venn Diagram

I don't really know if I'm posting in the right place but I hope so. I'm writing my bachelor degree, and I collected some data about fonts and language support. At the moment, all my data is stored in an excel spreadsheet, in the form of: Column: language support (e.g. Cyrillic, Cyrillic extended, Arabic, Vietnamese, Devanagari, etc) Rows: names of the fonts that supports that language, up to 890 Note that some of there fonts, even though they occur only …
Category: Data Science

ACF field group not showing in page

i've created an ACF field group just for one page, since my clients will need to upload 2 files directly related to that page (it's a page about a basketball team, so they'll have to upload the leaderboards and upcoming matches from time to time). So i've set up the field group like this: As you can see this field group only shows if the page is 1° divisione (the team's name). But when it comes to call that field …
Category: Web

Get first video from the post (both embed and video shortcodes)

The goal is to grab the first video (embed or shortcode) from the post. So we need to check post content if it has embedded videos ( supported by WP ) or [video] shortcodes. Multiple videos and embeds could exist in the single post. If found any - return the very first of them, not depending on order of given patterns to match, but on order they have been inserted into the post. Here is my progress so far... This …
Category: Web

Override Dokan Includes File in Child Theme

I'm trying to override this Dokan plugin file in a child theme: wp-content/plugins/dokan-pro/includes/modules/vendor-verification/templates/verification-new.php I can successfully override files in the normal Dokan templates folder: wp-content/plugins/dokan-pro/templates/path-to-file.php by using wp-content/themes/theme-child/dokan/path-to-file.php However, because the file I wish to override is in the includes folder, I'm having trouble finding the correct file path to override the verification-new.php file. Any ideas? P.S. The reason why I wish to override the file in a child theme rather than simply edit the original is so I can …
Category: Web

Does Cross Validation require splitting/shuffling and fitting of data beforehand?

I am trying to evaluate a logistic regression classifier using k-fold cross validation. I wanted to know if I need to shuffle data before hand when using cross_validate_predict and if I need to fit the data before hand as well: # THIS DOES A RANDOM SHUFFLE X_train, X_test, y_train, y_test = train_test_split(x, y, test_size = 0.33, random_state = 42) transformer = WEASELMUSE(strategy='uniform',word_size=4, window_sizes=np.arange(5, 70)) logistic = LogisticRegression(solver='liblinear', multi_class='ovr') clf = make_pipeline(transformer, logistic) # DO I NEED TO FIT THE DATA? …
Category: Data Science

Why is my child theme style.css not found (404) in the front-end?

I have a brand new Wordpress install (5.9.3) served by nginx (1.13.12). I'm using Docker containers for nginx and wordpress. I created a child theme based on twentytwentytwo following the WP codex instructions. It shows in the wp-admin and I was able to activate it and customize it through the block Editor. Now I want to add a css class to my style.css. Here's the function to enqueue my child-theme's styles : add_action( 'wp_enqueue_scripts', 'chesnaie_styles' ); function chesnaie_styles() { $parenthandle …
Category: Web

How to create frontend Post filter using meta query

I have created a post filter like the image below, but I have an issue with selecting multiple values from different fields. All the fields in the filter are custom fields. The thing is, in the admin panel, one post has a select field with city Telaviv and with a select field Property Type with a value Garden Apartment. The other post has a different city and Property Type as Ground Apartment. On the front end, if I choose from …
Category: Web

Image similarity: Similarity of mixed vector

In order to identify the similarity between images (products) I want to use a neural network approach similar to TiefVision. This pre-trained neural network is basically translating the images into a feature vectors and then creating a similarity measure between the images using a distance measure between the vectors. To make it more tangible have a look at a 2D visual representation below. I want to take it one step further: When a single user "likes" multiple images, I want …
Category: Data Science

ACF: If field contain a specific value, update value in another field

As I wrote in the title, how can I change the value of a field based on the value of another field programatically? This other field has already a value but I need to replace / update it. To be more precise: If the Text Field named type has value "Houses" AND another Text Field named service has value 2, this should be updated in NOT AVAILABLE. Or ... If the Text Field named type has value "Parks" AND another …
Category: Web

How create a Shortcode with hover and complex options

I am wondering how do you do when you have to create a shortcode with multiple hover or complex options ( gradient, boxshadow etc, thing that can't be inline ). How do you generate the css. I don't want to generate a <style></style> block because for a simple shortcode used 10 times in the page would generate 10 blocks. All the shortcode are set from the page, by the user, so are created when the_content() is called. I want to …
Category: Web

sklearn pipeline ValueError: Found input variables with inconsistent numbers of samples

I am receiving the following error. I have check shapes of X and y, and did no find error from sklearn.model_selection import train_test_split from sklearn.utils import check_consistent_length labels = ['non-role','role'] X = df[["POS", "NER", "DEF", "SYN"]] y = df["Label"] X_train, X_test, y_train, y_test = train_test_split(X, y, random_state=0, test_size=0.2, shuffle=True) print(X_train.shape) print(y_train.shape) print(X_test.shape) print(y_test.shape) print(check_consistent_length(X_train, y_train)) And here is the output: (25238, 4) (25238,) (6310, 4) (6310,) None I was trying to fit in the model: NB_pipeline = Pipeline([('tfidf-vect', TfidfVectorizer()),('clf', RandomForestClassifier())]) …
Category: Data Science

Machine Learning based Multivariate Time Series Prediction - How to create supervised data format

Q1: I have a multivariate time series dataset. For each timestep, there are 11 features and 1 output. I am going to use supervised ML to predect the output. I understand that in univariate cases, if I am going to use the past 3 days to predict the t-th day, the dataset will be formatted as x(t-3) | x(t-2) | x(t-1) | x(t) , where x(t) is the output to predict. How should I format the dataset when it is …
Category: Data Science

save_post trigerred twice

I am trying to add more functionality to the update button. My end result is that I wish to call a python script but for now I am messing around with writing a log file. This is resulting in the log file being written to twice. Can someone help me? add_action('save_post', 'test',10,2); function test($id, $post) { if ($post->post_type != 'item'){ return; } if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE ) { return; } if (wp_is_post_revision($id)) { return; } if (wp_is_post_autosave($id)) { return; } …
Category: Web

Is my data good for (DBSCAN) clustering?

I have a particular dataset consisting of 50k elements with 40 features each. I want to try to cluster the data as it is, without any dimensionality reduction. The main algorithm I am considering is the DBSCAN since is the more versatile and I can accept some poits to result as noise. However how can I judge if the clustering is "significant" since I can't plot the clusters in comparison to the data? Tring to select the paremeters for the …
Category: Data Science

How to filter custom post by rating star

First user fill this custom comment form. This is my meta_key i want that i want to fetch. for every comment there are 10 rating. I want to make below rating filter.But don't know how to start. This is what i tried yet. add_action( 'comment_post', 'show_message_function', 10, 2 ); function show_message_function( $comment_ID, $comment_approved ) { $comment = get_comment( $comment_ID ); if( empty($comment) ) { return; } $post = get_post( $comment->comment_post_ID ); $post_comments = get_comments( ['post_ID' => $post->ID ] ); $meta_value …
Category: Web

Time Series Generation - Multi Dimensional Time Series Data

Disclaimer: Mathematicians please don't be mad at me for the use of some of the terminologies in this post. I am an Engineer. :-) Background: So I am currently working on a problem where I have to generate a time series sequence of a process in which n actors are moving in a 2d space. But i don't know if this is even possible .The process being learned by some machine learning model M. BTW! I have never worked with …
Category: Data Science

Page with the same name of a category

I've a category, let's say "testcat". I want to create some pages which the final url should be "http://example.com/testcat/pagename". To do this, I should create a page named "testcat" and then a page named "pagename" with the page "testcat" as parent page. I tried and it seemd to work, but I'm worried about what's happening in the backend as actually there should be TWO pages on the same url http://example.com/testcat/: the default category page for "testcat" category and my custom …
Category: Web

Unsupervised learning for anomaly detection based on memory and cpu usage

Recently got into Data Science, I've been working on a data science project, I have built a system that collects real-time logs on virtual machines in the cloud, the logs include memory consumption and cpu usage data. I started researching online and discovered endless amount of information on these topics, however I couldn't find an answer or figure out which unsupervised model would best suit my needs (time series analysis, isolation forest, statistical model, etc...); a model that could detect …
Category: Data Science

Pagination in custom post type page template

I made a query for my custom post type "websites". I'm trying to get the pagination working but I'm running in some errors. I think the whole code is ok, only the part just before the end while tags. I just don't know how to get this right. Any help would be enormously appreciated! <?php // WP_Query arguments $args = array ( 'post_type' => 'website', 'post_status' => 'publish', 'pagination' => true, 'posts_per_page' => '5', 'posts_per_archive_page' => '5', 'ignore_sticky_posts' => false, …
Category: Web

Transform multi-class problem to multi-label problem

I found this question but I need an answer to the other direction. Example: Let's say we want to predict if a person with a certain profile wants to buy product A and/or B. So we have 2 binary classes A and B that don't exclude each other: A B 0 1 1 1 0 0 1 0 ... (We don't want to predict how likely it is for a person to buy B if the person has already bought …
Category: Data Science

Looking for a way to load a function after customizer preview refresh complete

I need to load a callback function after a wp.customize.previewer.refresh(). I need this because I want to update a template position which is displayed with a custom hook in my theme and scroll the preview frame on the new template position. I use wp.customize.previewer.bind('synced', ...) but every time I change the position on my control, this bind event calls itself as many times as I change the position. So after the first position update on my control, the bind event …
Category: Web

Positive/negative training sample imbalance in multi-label image classifiers

I'm trying to train VGG-16 on the Pascal VOC 2012 dataset, which has images with 20 labels (and a given image can have multiple classes present). The examples are highly imbalanced, so I've "balanced" them such that each label is represented roughly equal in the training set. But this means that for each label, 5% of the total images are positive examples and 95% are negative samples. There is no way to achieve a 50/50 split for all classes. I'm …
Category: Data Science

Pytorch - Loss is decreasing but Accuracy not improving

It seems loss is decreasing and the algorithm works fine. But accuracy doesn't improve and stuck. import numpy as np import cv2 from os import listdir from os.path import isfile, join from sklearn.utils import shuffle import torch.nn as nn import torch.nn.functional as F import torch.optim as optim from torch.autograd import Variable import torch.utils.data file_path_0 = [f for f in listdir("data/0") if isfile(join("data/0", f))] file_path_1 = [f for f in listdir("data/1") if isfile(join("data/1", f))] data_x = [] data_y = [] for …
Category: Data Science

About

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