How can i filter wordpress users by custom feild?

I'm displaying users (authors) on a page. how can I add a filter based on user custom feilds? <?php // THE USER QUERY ARGS $args = [ 'role' => 'author', 'number' => -1, ]; // THE USER QUERY $user_query = new WP_User_Query($args); // THE TOTAL SUBSCRIBERS NUMBER echo '<h3 class="font-weight-bold">Total Listed Shops: ' . $user_query->get_total() . '</h3>'; echo '<hr>'; // THE USER LOOP if (!empty($user_query->get_results())) { foreach ($user_query->get_results() as $user) { // ACF PREFIX & FIELD DATA FROM USER PROFILE …
Category: Web

Sort categories by meta value

How can I make a list of categories with 4 last posts in each where every category is sorted by meta_value. For example, template without sorting by meta_value is http://pastebin.com/AeH6vx9b It displays parent categories only. Few days I am searching something related to categories extra fields but can't find something workable. This is my best search result. What I have to do with this? I don't understand it. Is it possible to do what I want?
Category: Web

Training neural network for regression with gaussian output layer

How does one train a neural network model that does regression over real values, using a gaussian output layer? ie estimating the mean and std parameters of the prediction. Since during training there will only be one real valued target. Would one sample from the output gaussian distribution and then perform loss with the target? Or would there somehow be two targets, one for the mean or std. The Deep AR forecasting model by Amazon does something like this for …
Category: Data Science

set and unset the custom field value

While showing all the posts together in admin panel, I have a custom column 'Featured Image'. And this column has a value YesOrNO. To set the column name : I have inside functions.php: function set_column_heading($defaults) { $defaults['featured_image'] = 'Featured Image'; return $defaults; } add_filter('manage_posts_columns', 'set_column_heading'); In order to set the column value, I have : function set_column_value($column_name, $post_ID) { if ($column_name == 'featured_image') { $post_featured_image = get_featured_image($post_ID); if ($post_featured_image) { echo 'YesOrNO'; } } } function get_featured_image($post_ID) { $post_thumbnail_id = …
Category: Web

Store's unseen items sales forecasting

I am working on sales forecasting problem.I am able to provide data about which items got sold and not sold to the algorithm.How to provide algorithm information about items that are not present in the store.Is there any way we could encode this information in data or any other algorithms accepts this kind of information.Currently, I am using Neural Networks and Random Forest to forecast Sales.
Category: Data Science

get_the_terms() returning wrong results inside of loop

When I use get_the_terms() inside a loop, the whole thing behaves very strangely. Sometimes the terms are included twice or three times and sometimes a post inside of the loop returns only false. I have used get_the_terms() over and over for the last few years without any problems. So i'm quite confused right now. It seems like wp_get_post_terms() and wp_get_post_categories() are getting out the correct data but I would like to know why get_the_terms() is behaving this way inside of …
Category: Web

how to calculate loss function?

i hope you are doing well , i want to ask a question regarding loss function in a neural network i know that the loss function is calculated for each data point in the training set , and then the backpropagation is done depending on if we are using batch gradient descent (backpropagation is done after all the data points are passed) , mini-batch gradient descent(backpropagation is done after batch) or stochastic gradient descent(backpropagation is done after each data point). …
Category: Data Science

WordPress stopped generating image thumbnails after changing hosting environment

I moved my WP website from shared hosting, to Digital Ocean LEMP stack droplet. I noticed that thumbnails aren't generated any more for new post featured images, I also tried manually regenarating thumbnails for specific images, it succeeds but nothing generated. I tried deactivation of the Force Regenerate Thumbnails plugin and activating it again, but still no luck. Any ideas?
Category: Web

Learner Algorithm Time & Sample Complexity

Let $X=R^{2}$. Let $u=\left(\frac{\sqrt{3}}{2},-\frac{1}{2}\right),\ w=\left(-\frac{\sqrt{3}}{2},-\frac{1}{2}\right),\ v=\left(0,1\right)$ and $C=H=\left\{h\left(r\right)=\left\{\left(x_{1},x_{2\ }\right)\ |\left(x_{1},x_{2\ }\right)\cdot u\le4,\ \left(x_{1},x_{2\ }\right)\cdot w\le r,\ \left(x_{1},x_{2\ }\right)\cdot v\le r\right\}\right\}$ for $r>0$, the set of all origin centered upright equilateral triangles. Describe a sample complexity algorithm $L$ that learns $C$ using $H$. State the time and sample complexity of your algorithm and prove it. I was faced with this question in a homework assignment and I'm a bit confused.. My solution is: Let D be our dataset Learner Algorithm: maxDistance …
Category: Data Science

Bookmark anchor link to load another page first before completing?

Question: is there a way for a link to an anchor bookmark to arrive at its destination by loading another page first? I'm developing a vertical-scrolling style website where the home page displays the contents of 3 other pages within sections or divs. Each section has a bookmark and a "back to top" link, and my main navigation menu uses custom bookmark anchor links. I'm also using thejQuery smooth scrolling plugin which works very well. The problem I'd like to …
Category: Web

Compare string entries of columns in different pandas dataframes

I have two dataframes, df1 and df2, both with different number of rows. df1 has a column 'NAME', a short string; and df2 has a column 'LOCAL_NAME', a much longer string that may contain the exact contents of df1.NAME. I want to compare every entry of df1.NAME with every entry in df2.LOCAL_NAME, and if df1.NAME appears in a particular entry of df2.LOCAL_NAME, I want to create add an entry in a new column df2.NAME_MAP = df1.NAME. If it doesn't appear …
Topic: pandas python
Category: Data Science

REGEXP_REPLACE in post_contet

So, basically, I want to remove trailing slashes from specific domain urls. For example: https://www.example.com/here/postname/ into https://www.example.com/here/postname I have 10.4.21-MariaDB which should support REGEXP_REPLACE function. This is my query: UPDATE wp_posts SET post_content = REGEXP_REPLACE(post_content, '(http\S+)\/(\s|$)', '$1'); or this one more specifically: UPDATE wp_posts SET post_content = REGEXP_REPLACE(post_content, '(https:\/\/www\.example\.com\/here\/\S+)\/(\s|$)', '$1'); which according to regular expressions should work: https://regex101.com/r/slLbgg/1 What am I doing wrong? Any kind of help is appreciated! :) This is the result:
Category: Web

Count posts per taxonomy else change taxonomy if less than x number

$taxonomy = $tag->count > 3 ? 'post_tag' : 'category'; $cats_or_tags = $tag->count > 3 ? $tag_ids : $cat_ids; $args = array( 'tax_query' => array( array( 'taxonomy' => $taxonomy, 'field' => 'id', 'terms' => $cats_or_tags The first part of this ternary works when checking the count of posts in a specific tag but the 2nd part doesn't. It's supposed to set the taxonomy and terms values if there's more than 3 posts tagged otherwise when less than 4, display posts from …
Category: Web

I don't think WordPress is loading jquery or bootstrap js

I'm building a WordPress theme and I've used the code from https://codeinhouse.com/how-to-create-custom-post-type-slider-in-wordpress-without-plugin/ to build my slider I've also used https://github.com/wp-bootstrap/wp-bootstrap-navwalker I have both jquery and bootstrap both linked to the site they appear in inspect element however they do not seem to be running as my drop down navigation does not work on mobile size and the slider doesn't slide function wpbootstrap_enqueue_styles() { wp_enqueue_style( 'bootstrap', get_template_directory_uri() . '/css/bootstrap.css' ); wp_enqueue_style( 'my-style', get_template_directory_uri() . '/css/style.css'); wp_enqueue_script('bootstrap-js', get_template_directory_uri() . '/js/bootstrap.js', array('jquery'), NULL, …
Category: Web

Sampling methods for Text datasets (NLP)

I am working on two text datasets, one is having 68k text samples and other is having 100k text samples. I have encoded the text datasets into bert embedding. Text sample > 'I am working on NLP' ==> bert encoding ==> [0.98, 0.11, 0.12....nth] # raw text 68k # bert encoding [68000, 1024] I want to try different custom NLP models on these embeddings, but dataset large to test the model's performance quickly. To check different models quickly, the best …
Category: Data Science

How to set different color in a select box due to selection with css

I have a select box with 2 options. In the selct area the options are green for 1 red for 2 I had been able to set green also as the color for the predefined option. Now I would like to change this due to the incoming selection. That means, if someone has 1 as predefined selection the color of the appearing conent of the shown select box should be green and if some has 2 as redefined selection the …
Category: Web

Interpreting interaction term coefficient in GLM/regression

I'm a psychology student and trying come up with a research plan involving GLM. I'm thinking about adding an interaction term in the analysis but I'm unsure about the interpretation of it. To make things simple, I'm going to use linear regression as an example. I'm expecting a (simplified) model like this: $$y = ax_{1} + bx_{2} + c(x_{1}*x_{2})+e$$ In my hypothesis, $x_{1}$ and $y$ are negatively correlated, and $x_{2}$ and $y$ are positiely correlated. As for correlation between $x_{1}$ …
Category: Data Science

Pre-process data images before training OneClassSVM and decrease number of features

I want to train a OneClassSVM() using sklearn, and I have a set of around 800 images in my training set. I am using opencv to read the images and resize them to constant dimensions (960x540) and then adding them to a numpy-array. The images are RGB and thus have 3-dimensions. For that, I am reshaping the numpy array after reading all the images: #Assume X is my numpy array which contains all the images before reshaping #Now I reshape …
Category: Data Science

Can I get un-normalized vectors from the TF USE model?

I'm using this Universal Sentence Encoder (USE) model to get embeddings of a set of texts, each text corresponding to a newspaper article. In order to build a Recommender System, I generate user embeddings by averaging the embeddings of items a user has read, and then I look for other texts that are cosine-similar to this user (basically, the method returns a set of items that are similar to this user embedding). Now, the problem is that the mentioned model …
Category: Data Science

How do I output user_registered time in my correct timezone?

I am currently using Wordpress, and an element of user_registered returns the time of registration of the user. I have set the correct timezone, but don't know how to get the user_registered output to match my current time. So far, this is what I have. date_default_timezone_set('America/Los_Angeles'); $users = get_users(); foreach( $users as $user ) { $udata = get_userdata( $user->ID ); $registered = $udata->user_registered; printf( '%s member since %s<br>', $udata->data->display_name, date( "Y-m-d H:i:s", strtotime( $registered ) ) ); } echo('date below …
Category: Web

Temperature lag forecasting

I am working on a data science project on an industrial machine. This machine has two heating infrastructures. (fuel and electricity). It uses these two heatings at the same time, and I am trying to estimate the temperature value that occurs in the thermocouple as a result of this heating. However, this heating process takes place with some delay/lag. In other words, the one-unit change I have made in fuel and electrical heating is reflected in the thermocouple hours later. …
Category: Data Science

Recommendations for modelling panel data

sending positive wishes to y'all. I have about 10 years of growth rates in real estate prices and some other macroeconomic variables such as inflation, unemployment rates, fuel prices, growth in prices of raw materials among many others. I want to analyze the causality of all of these variables on the growth in real estate prices. The simplest thing would be to build a linear regression model, but given this is not cross-sectional and more like a time series data, …
Category: Data Science

Can the Next/Prev Post links be ordered by menu order or by a meta key?

I have a series of posts that are ordered by a meta_key value. They could also be arranged by menu order, if necessary. The next/prev post links (generated by next_post_link, previous_post_link, or posts_nav_link all navigate by chronology. While I understand this default behaviour, I don't understand how to change it. I found that it maps through to adjacent_post_link in link-template.php, but then it starts to seem fairly hard-coded. Is it recommended to re-write this from scratch to replace it, or …
Category: Web

Number of capsules in the Primary Capsule Layer of Capsule networks

What is the Number of capsules in the Primary Capsule Layer of Capsule networks? In many articles, it is written that the number of Capsules is 32 but in the paper, by Hinton - Dynamic Routing between capsules it is written that "In total PrimaryCapsules has [32 × 6 × 6] capsule outputs (each output is an 8D vector) and each capsule in the [6 × 6] grid is sharing their weights with each other." which implies that the layer …
Category: Data Science

Url rewriting on custom post with CPT UI plugin

I checked all subjects in forum about this but i didn't found way to resolve my problem. sorry for my english, i'm french.. :) So.. i got a custom post listing ( with template listing pro ) there : http://easycowork.fr/bureau/easy-office-lille/ I created a custom post named service and i display all service associate on listing on the listing single page. When i click on a service, i display his data on the same page with a GET parameter ( the …
Category: Web

Is multicollinarity a problem when interpreting SHAP values from an XGBoost model?

I'm using an XGBoost model for multi-class classification and is looking at feature importance by using SHAP values. I'm curious if multicollinarity is a problem for the interpretation of the SHAP values? As far as I know, XGB is not affected by multicollinarity, so I assume SHAP won't be affected due to that?
Category: Data Science

How to obtain "wp_rest" nonce for WP Statistics plugin manually?

During my pentest of a client's websites I stumbled upon the WP with vulnerable WP Statistics plugin installed. To exploit this vulnerability, I should send a JSON-API request to endpoint /json-api/wp-statistics/v2/.... The problem is I must send correct _wpnonce along with my request. I found a cool explanation here: https://gist.github.com/Xib3rR4dAr/5dbd58b7f57a5037fe461fba8e696042 They recommend to extract the _wpnonce value from the legitimate URLs from the website page source. But I don't see similar URLs anywhere. My guess is that the plugin installed …
Category: Web

WordPress navigation wont appear with wp_head

so im building a custom theme and ive got stuck on the navigation if i use wp_head(); it loads bootstrap and my custom style sheet but not the navigation if i use get_header(); it loads the navigation but not bootstrap or my custom style sheet here is my functions.php function register_navwalker(){ require_once get_template_directory() . '/inc/class-wp-bootstrap-navwalker.php'; } add_action( 'after_setup_theme', 'register_navwalker' ); function wpbootstrap_enqueue_styles() { wp_enqueue_style( 'bootstrap', 'https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css' ); wp_enqueue_style( 'my-style', get_template_directory_uri() . '/style.css'); wp_enqueue_script('bootstrap-js', 'https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js', array('jquery'), NULL, true); } add_action('wp_enqueue_scripts', 'wpbootstrap_enqueue_styles'); …
Category: Web

Perceptron Learning Rule

I am new to Machine Learning and Data Science. By spending some time online, I was able to understand the perceptron learning rule fairly well. But I am still clueless about how to apply it to a set of data. For example we may have the following values of $x_1$, $x_2$ and $d$ respectively:- \begin{align}&(0.6 , 0.9 , 0)\\ &(-0.9 , 1.7 , 1)\\ &(0.1 , 1.4 , 1)\\ &(1.2 , 0.9 , 0)\end{align} I can't think of how to …
Category: Data Science

Child Theme not overwriting Parent theme php file

I'm new to Wordpress and how Child themes work. My child theme I am trying to overwrite two files in sub-directories. I've copied the parent files and edited them in child theme but changes are not reflected in parent theme. I'm trying to change the code for feature image sizes. I successfully changed the code in parent to test it and it works. But child theme isn't overriding it. /public_html/wp-content/themes/sahifa/framework/functions/theme-functions.php /public_html/wp-content/themes/sahifa-child/framework/functions/theme-functions.php /public_html/wp-content/themes/sahifa/framework/parts/related-posts.php /public_html/wp-content/themes/sahifa-child/framework/parts/related-posts.php Other question I had was do I …
Category: Web

Initialization of VGG layer weights in pytorch

In config file, VGG layer weights are initialized using this way: from easydict import EasyDict as edict MODEL = edict() MODEL.VGG_LAYER_WEIGHTS = dict(conv3_4=1/8, conv4_4=1/4, conv5_4=1/2) But how to initialize it using a parser? I have tried to do this the following way: parser.add_argument(’–VGG_LAYER_WEIGHTS’,type=dict, default=conv3_4=1/8, conv4_4=1/4, conv5_4=1/2, help=‘VGG_LAYER_WEIGHTS’) But got error. Please help me to write it correctly.
Topic: vgg16 pytorch
Category: Data Science

Count posts in category including child categories

I have found this code somewhere, it counts posts but only which are under specific category. I would appreciate if someone could expand this so it would count all posts which also belong to its child categories? function wp_get_cat_postcount($id) { $cat = get_category_by_slug( $id ); $count = (int)$cat->count; $taxonomy = 'category'; $args = array( 'child_of' => $id, ); $tax_terms = get_terms($taxonomy,$args); foreach ($tax_terms as $tax_term) { $count +=$tax_term->count; } return $count; }
Category: Web

How to get product count with respect to categories in WooComerce

Hi I want to display all the categories of products in a loop to display them in category menu along the numbers of products each category contains. Some thing like that so far I have done this to get all categories $args = array( 'number' => $number, 'orderby' => $orderby, 'order' => $order, 'hide_empty' => $hide_empty, 'include' => $ids ); $product_categories = get_terms( 'product_cat', $args ); foreach( $product_categories as $cat ) { echo $cat->name; } But I want to know …
Category: Web

Multiple do_shortcode($content) within one shortcode

TLDR; How can I run a shortcode with multiple shortcodes inside of it? I'm trying to run a shortcode with multiple shortcodes inside of it. I can successfully run a shortcode with one shortcode inside of it with the following code in the theme: add_shortcode('outside_shortcode', function($attr, $content = null) { return ' <section class="example_section"> <div class="container"> <div class="row"> ' . do_shortcode($content) . ' </div> </div> </section> '; }); add_shortcode('inside_shortcode', function($atts, $content = null) { $atts = shortcode_atts( array( 'link' => …
Category: Web

Criteria used to create and select leaf nodes in sklearn

I just want to know the details of what (and how) is the criteria used by sklearn.tree.DecisionTreeClassifier to create leaf nodes. I know that the parameters criterion{“gini”, “entropy”}, default=”gini” and splitter{“best”, “random”}, default=”best” are used to split nodes. However, I could not find more information about the threshold used for spliting. There are some methods involved in the creation of leaf nodes: post-pruning (cutting back the tree after a tree has been built) and pre-pruning (preventing overfitting by trying and …
Topic: scikit-learn
Category: Data Science

About

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