How to get correct URLs in network wide menu (Multisite)?

I'm using this function to switch to my main website's navigation and display it on all sub sites in my multisite network. Ideally the links should have the following format: http://www.mysite.com/navigation-link but on the sub-sites the urls are http://www.mysite.com/subsite/navigation-link Obviously these pages don't exist so it's just showing a blank page. Any idea how I could make sure the urls are like the first example and how I might incorporate that into my function? function wp_multisite_nav_menu() { global $blog_id; $args …
Category: Web

how to assign back categorical variables to train and test data after training and testing using inverse_transform?

how to assign back categorical variables to train and test data after training and testing using inverse_transform? Like training and testing, data will have encoded numerical values. So, how to assign back categorical values to those variables to train and test dataset after training and testing? Please help me with this.
Category: Data Science

How are natural language generation algorithms given a target

I've started learning about NLP and NLG and I'm fascinated! I've been blown away by the things I've seen from NLP; but I have a few questions about NLG. All my questions boil down to this: Given a network or Markov chain how does one specify what you want the system to talk about? To explain this a little; if I ask my 5 year old nephew to tell me something he'll talk about his toys, or what's on TV …
Topic: nlg nlp
Category: Data Science

Proxy External API request in PHP from Edit.js in Block Plugin

I'm working with a third-party API that has optional filters on their API. I'm creating a block where the user has two select elements in Edit.js that are displayed on the backend of the block. They can select filters, specialty, and location, these values are then stored in attributes. Once a user changes a select, I want to fire off a PHP request using these attributes passed to the PHP function that uses wp_remote_get() to build the proxy and dump …
Category: Web

How to get vector representations(or embeddings) of time series?

Even if a time series is constructed up of numbers only, finding abstract fixed-dim vector representation would be interesting for classification/clustering purposes. As we can learn & find abstract representations/embeddings of text/images, can we do something similar on Time series? Finding such ways would result in better clustering & related tasks instead of traditional ways using some statistical measures like Pearson correlation etc. All thoughts are welcome.
Category: Data Science

How to pass taxonomy terms to WP_Query along with $args?

I created a cpt and custom taxonomy associated with it. Lets say custom taxonomy name is Sports. I added terms to it - football, basketball. Now, i want to fetch post titles tagged under football and basketball separately on same page.(Note:- i am using a custom page template to show list of articles from CPT). $args = array( 'post_type' => 'sports', 'tax_query' => array( array( 'taxonomy' => 'sports_category', 'field' => 'slug', 'terms' => 'football' ), ), ); $myquery = new …
Category: Web

Can depth be used as a feature when predicting rock type from well log data?

I am trying to predict the lithofacies, i.e. the rock type, from well log data, a project very similar to the one described in this tutorial. A well log can be seen as a 1D curve tracking how a given property (e.g. gamma radiation, electrical resistivity, etc...) varies as a function of depth. The idea is to use these 1D arrays as the input features to train a Machine Learning model (e.g. SVM or Random Forest), to infer the facies …
Topic: training svm
Category: Data Science

Features of the fourier transform for machine learning

i intend to extract features from time-domain measurement data. I feed the features to machine learning algorithms to detect anomalies. In the time-domain, i extract mean, RMS, skew and standard deviation. I also want to execute a fourier transform and extract the features from the fourier transform. Intuitively, i would pick the mean frequency and the peak frequency for different frequency bands. Unfortunately, i cant find any literature on the topic or other people who extracted features from fourier transform …
Category: Data Science

Updated Wordpress, now getting errors on site

I just recently updated my Wordpress, theme, and plugins, and am now getting these two errors on top of the homepage and pages page. Deprecated: wp_make_content_images_responsive is deprecated since version 5.5.0! Use wp_filter_content_tags() instead. in /var/www/html/wp-includes/functions.php on line 4773 and the pages page, Notice: register_rest_route was called incorrectly. The REST API route definition for pum/v1/analytics is missing the required permission_callback argument. For REST API routes that are intended to be public, use __return_true as the permission callback. Please see Debugging …
Category: Web

How to change language file used by _e function

I am trying to make my own language switcher for my WordPress site. I am generating all labels using the _e and similar functions. So I am guessing the only thing I need to do is to change the locale used by WordPress. How can I do this programmatically? So in the ideal scenario when a user clicks on the desired language "this code" is run and WordPress uses the corresponding .mo file for the translation.
Category: Web

How do you maximize a left skewed variable in a dataset?

I analyzed a dataset of tourist expenses for a country here: https://rpubs.com/lovepeacejoy404/tourist_spending_tanzania and I noticed that the variable total_cost (how much the tourist spent in total) is skewed left because tourists tend to spend as little as possible and then there are few who spend a lot. If I am interested in identifying which aspects of tourism are more profitable and in which it is worthwhile to invest, should I consider for the categorical variables the highest value of the …
Category: Data Science

Disable CSS specific page

I want disable one specific page of the default css, and i want use my css on the specific page. I don't know it is posibble? I use Blank State plugin, for create blank page, but css its on the blank pages, but i want my css use on the specific blank pages. https://wordpress.org/plugins/blank-slate/ So, i have one page, that name: test-area-7 Code: add_action('wp_enqueue_scripts', 'my_script', 99); function my_script() { if(is_page( 'test-area-7' )){ wp_dequeue_script('fpw_styles_css'); } } EDITED add_action('wp_enqueue_scripts', 'my_script', 99); function …
Topic: css Wordpress
Category: Web

How to deal with name strings in large data sets for ML?

My data set contains multiple columns with first name, last name, etc. I want to use a classifier model such as Isolation Forest later. Some word embedding techniques were used for longer text sequences preferably, not for single-word strings as in this case. So I think these techniques wouldn't be the way that will work correctly. Additionally Label encoding or Label binarization may not be suitable ways to work with names, beacause of many different values on the on side …
Category: Data Science

One-sided time series trend-seasonal decomposition

TL;DR: Are there one-sided decomposition alternatives to the naive seasonal_decompose from statsmodels? Are there approaches to adapt intrinsically two-sided algorithms (like STL from statsmodels) to forecasting applications? I'm attempting to perform time-series forecasting. For this I want to decompose a time-series into trend and seasonal parts. I picked STL implementation from statsmodels to handle this. I gravitated towards STL instead of seasonal_decompose, since even the docs down the bottom encourage more sophisticated approaches: I noticed, however, that the decomposition is …
Category: Data Science

How to display a specific category using a custom Query in WordPress?

Hi I want to display a specific category from a custom query in WordPress. My code works fine and it gets the latest 4 posts, but what I want now is to retrieve a specific category. My code is below thanks : global $wpdb; $posts = $wpdb->get_results( 'SELECT ID, post_title AS title, post_excerpt AS excerpt FROM '.$wpdb->posts.' WHERE post_type = "post" AND post_status = "publish" ORDER BY post_date DESC LIMIT 4' );
Category: Web

ValueError: Tensor Tensor("activation_5/Softmax:0", shape=(?, 2), dtype=float32) is not an element of this graph

There seem to be an issue with predicting using my keras model. I had trained it using the following keras code: model = Sequential() model.add(Conv2D(32, (3, 3), input_shape=(150, 150,3),padding='same')) model.add(Activation('relu')) model.add(MaxPooling2D(pool_size=(2, 2),padding='same')) model.add(Conv2D(32, (3, 3),padding='same')) model.add(Activation('relu')) model.add(MaxPooling2D(pool_size=(2, 2),padding='same')) model.add(Conv2D(64, (3, 3),padding='same')) model.add(Activation('relu')) model.add(MaxPooling2D(pool_size=(2, 2),padding='same')) model.add(Flatten()) # this converts our 3D feature maps to 1D feature vectors model.add(Dense(64)) model.add(Activation('relu')) model.add(Dropout(0.5)) model.add(Dense(2)) model.add(Activation('softmax')) model.compile(loss='binary_crossentropy', optimizer='rmsprop', metrics=['accuracy']) However when i predict it on my local system after training with the shape (1,150,150,3) . …
Category: Data Science

from website from scratch to wordpress

I am not a full time website developer although i've developed some websites from scratch with HTML, CSS, Bootstrap, Javascript/jQuery etc usually for websites that have very specific purposes (e.g. custom calculators for business to find profit, margins, etc). For very simple websites I've used Wix. Now I'll start working on more complex but usual projects like e-shops, hotel pages etc. and I'm thinking to move to wordpress and woocommerce for e-shop pages, as it has many stuff that i'll …
Category: Web

Does WordPress being under GPL actually necessitate that the tools created for it (plugins, themes) must also be under GPL? Is so, then why?

I'm confused about this idea that because WordPress is under GPL, the plugins and themes all have to be under GPL as well. My understanding of GPL includes that you can't distribute something that is partially GPL and partially proprietary; but if you distribute a proprietary plugin, shouldn't it be fine for a user to use that plugin within their GPL copy of WordPress? The problem should only arise if the user tries to distribute their WordPress installation along with …
Category: Web

Get tax rate label of "orderlineitem" in woocommerce and store in xml

How to show tax percentage for each item in order in an xml. i create xml when order is paid. but need to show item tax labels for each items for example. "7% Mswt", "19% Mswt". function get_line_items( $order ) { $items = []; /** @var \WC_Order_Item_Product $line_items */ $line_items = $order->get_items( 'line_item' ); // loop through each item in order foreach ( $line_items as $item_id => $item ) { // get the product /** @var \WC_Product $product */ $product …
Category: Web

Methods for augmenting binary datasets

I have a small (~100 samples) dataset with roughly 20 features which are mostly binary, and a few are numeric (~5). I wanted to use methods for augmenting the training set and see if I can get better test accuracy. What methods/code can I use for augmenting binary datasets?
Category: Data Science

Display alt text as tool tip on page

I'm using the Background Manager Wordpress plugin (http://wordpress.org/plugins/background-manager/) and I'm trying to display a custom element on the page that I have not been able to find any help on as of yet, including with their forums. The plugin outputs a full-screen background, which includes alt text, and I'm wondering if there's a way I can display the alt text on the page in a DIV? The code that displays on the page currently is: <!-- Background Manager Start --> …
Category: Web

Optimal representative participation in the age of AI/ML?

Just answered the great questions of the 2022 Stack Overflow Developer Survey and earned the Census - Badge, here I see the number of filled surveys and as an enthusiastic beginner in data science I am curious about the optimal representative participation in case of 17,866,773 total users!? I did a quick research, but stuck at the following sentence: "Once the population exceeds 20,000, your sample size will not change very much anymore." Please help me to understand this (agree/disagree …
Category: Data Science

Modifying Chart Legend WPBakery

This is a WORPRESS plugin issue. Can someone who is familiar with the WPBakery Plugin/Page Builder on Wordpress please show me how to change the position of the legend on my donut chart? Before it would be on the right side of the chart and with circles, not rectangles. Now it is on top of the chart and it is pushing the chart and the content downward on the page (images below). Again this IS a Wordpress Plugin issue. Thank …
Category: Web

Query multiple post types, but different order for each

I have a query which searches 2 post types as below: $args = array( 'post_type' => ['post', 'promotion'], 'posts_per_page' => 12, 'paged' => $paged, 's' => isset($_GET['search']) ? $_GET['search'] : '', ); This orders them by default, by published date. I need to add a third post type events. This however needs to be sorted by a custom field event_date asc and to disregard those which the event_date is in the past. Does anyone have any suggestions on how this …
Category: Web

How to determine the number of Neurons in each hidden layer and number of hidden layers for face recognition

I plan to build a CNN for face recognition using this Kaggle dataset. I tried building a model with a single hidden layer with 256 fully connected neurons, and it gave an accuracy of 45% after 55 epochs. Should I just set the no. of hidden layers (and the no. of neurons in the layers) as variables, and repeat the model evaluation process for various values of the variables to determine the optimum values? Or is there any other, more …
Category: Data Science

how to register / add multiple options into one field in wordpress?

How can I register or add multiple options into one field. For example, we save a logo in get_options() by registering the setting and adding fields by add_settings_field() function and we output it accordingly. But what if we want to save multiple options into one field, like we have an option on our page called "Select your favourite colour" and there are check-boxes with different colours and user needs to select multiple colours (not a single colour) then how would …
Category: Web

Self-attention mechanism did not improve the LSTM classification model

I am doing an 8-class classification using time series data. It appears that the implementation of the self-attention mechanism has no effect on the model so I think my implementations have some problem. However, I don't know how to use the keras_self_attention module and how the parameters should be set. The question is how to utilize keras_self_attention module for such a classifier. The first confusion matrix is 2 layers of LSTM. lstm_unit = 256 model = tf.keras.models.Sequential() model.add(Masking(mask_value=0.0, input_shape=(X_train.shape[1], X_train.shape[2]))) …
Category: Data Science

How to export shap waterfall values to dataframe?

I am working on a binary classification using random forest model, neural networks in which am using SHAP to explain the model predictions. I followed the tutorial and wrote the below code to get the waterfall plot shown below row_to_show = 20 data_for_prediction = ord_test_t.iloc[row_to_show] # use 1 row of data here. Could use multiple rows if desired data_for_prediction_array = data_for_prediction.values.reshape(1, -1) rf_boruta.predict_proba(data_for_prediction_array) explainer = shap.TreeExplainer(rf_boruta) # Calculate Shap values shap_values = explainer.shap_values(data_for_prediction) shap.plots._waterfall.waterfall_legacy(explainer.expected_value[0], shap_values[0],ord_test_t.iloc[row_to_show]) This generated the plot as …
Category: Data Science

How to change "Read More" text?

I'm using blogstart wordpress theme and I would like to change "Read more" text to something similar to language than I'm using. How can I do that? I already tried to paste code below to functions.php. Replaces the excerpt "Read More" text by a link function modify_read_more_link() { return '<a class="read-article" href="' . get_permalink() . '">Your Read More Link Text</a>'; } add_filter( 'the_content_more_link', 'modify_read_more_link' ); // Replaces the excerpt "Read More" text by a link function new_excerpt_more($more) { global $post; …
Category: Web

Wordpress cron job running more than once

I developed a plugin to read some XML files and publish their itens as post but for some reason, sometimes, it is duplicating posts. Basically that is what I have: // function one is scheduled (hourly) and unscheduled on plugin activation and deactivation hooks register_activation_hook(__FILE__, 'function_one_activation'); register_deactivation_hook(__FILE__, 'function_one_deactivate'); function function_one_activation() { if (!wp_next_scheduled('function_one_cron')) { wp_schedule_event(time(), 'hourly', 'function_one_cron'); } } function function_one_deactivate() { $timestamp = wp_next_scheduled('function_one_cron'); wp_unschedule_event($timestamp, 'function_one_cron'); } add_action('function_one_cron', 'one'); add_action('function_two_cron', 'two'); add_action('function_three_cron', 'three'); function one() { // download XML …
Category: Web

Downsample GPS track

I am working with GPS track files (list of X and Y coordinates). I have tracks with a high sampling rate and want to downsample the track for easier handling. The obvious way would be to create a new list of points, and to keep only (for example) every 100th point of the track. The problem is that this could remove important extremes, such as curves. Do you know algorithms, which allow to downsample the two dimensional array, while keeping …
Category: Data Science

Apostrophes replaced by '

I use a plugin for automatic posting of articles on social networks, and when I send an article on Facebook or Twitter from my website, the apostrophes of my articles are replaced by this: ' It is possible that the problem comes from the theme, but I am not sure. I tried to do a "search and replace" to replace this code with an apostrophe using a "regex" but it does not work at all
Category: Web

Wordpress: redirecting to my old public ip

I started to develop my own wordpress site, that I hosted locally. I am using Apache for hosting and mariaDB for DB. I accessed the site through my public ip, that in my case was was xxx.xxx.1.163. I could also access my site thorugh 127.0.0.1. I set the wordpress site up and everything worked fine. PROBLEM Until I moved from one place to another with my computer. Now I can not access my site anymore. I have been struggling with …
Category: Web

custom taxonomy and custom post type url conflict

i am having one serious url issue. there is news custom post type. it's slug is news. News taxonomy slug: news_category News taxonomy url is: http://domain.com/news_category/press-release i want to change the url of the news_category to news news . so url of news taxonomy would be: http://domain.com/news/press-release i tried to rewrite the slug news_category to news but that's creating conflict issue. news shows news url but all the posts of news post type are returning 404 not found News post's …
Category: Web

About

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