How to build multiple variable regression having a mix of numerical & categorical features?

There is a need to estimate Annual Average Daily Traffic Volume (AADT). We have bunch of data about vehicles' speeds during several years. It is noticed that AADT depends on the average number of such samples during some time, so a regression model $Y = f(x_1)$ could help estimating the AADT. The problem is there are other features affecting the dependency which are both numerical $(x_2, .., x_k)$ and categorical $(c_1 = data\ provider, c_2 = road\ class, .., c_m)$. …
Category: Data Science

Hook or callback when wp_nav_menu() has completed

I am modifying the $output of wp_nav_menu() using a custom walker, and I need to run a function after the final closing </ul> of the entire menu. I can only see the following methods available: start_lvl() // Runs when a child menu is started end_lvl() // Runs when a child menu is completed start_el() // Runs when a menu item is started end_el() // Runs when a menu item is completed I can't find anything that runs when the top …
Category: Web

Why is my validation loss never INcreasing?

I am currently training different neural networks for the binary classification of images. When using the logistic regression, my validation loss never increases, even not after 5000 epochs. I thought that at some point overfitting happens and the validation loss always increases. Does anybody know why this does not happen?
Category: Data Science

How to order query results based on if a custom field has been populated, then the order by the date of the post?

I am trying to custom sort a query for product posts (custom content type) based on if a specific ACF custom field for a product ID number has been populated. My client wants to feature products with this first as it adds extra details for inventory. My current script works to a degree, but doesn't seem to factor date into the order/sort so I am assuming it is sorting based on the actual product ID number, versus if it just …
Category: Web

Overfitted model produces similar AUC on test set, so which model do I go with?

I was trying to compare the effect of running GridSearchCV on a dataset which was oversampled prior and oversampled after the training folds are selected. The oversampling approach I used was random oversampling. Understand that the first approach is wrong since observations that the model has seen bleed into the test set. Was just curious about how much of a difference this causes. I generated a binary classification dataset with following: # Generate binary classification dataset with 5% minority class, …
Category: Data Science

Site redirecting to http://example.com/wp-signup.php?new=example.com

My hosting provider just moved my newly developed website from my testing domain to the definitive domain. But now my site url say's example.com/wp-signup.php?new=example.com And I don't see the page. The site worked great on my previous domain, the site was moved completely to my main domain, all domain names are changed in the database to my new domain I've been searching on this problem on Google. I did find these two pages Site Redirecting to wp-signup.php My wordpress multisite …
Category: Web

Real World Regression R & p-value

I am trying to figure out whether our customer support has an impact on tickets opened by customers. Our employees should contact customers to avoid that a user will open a ticket. The data is quite accurate. I am plotting the (pro-active) contacts per day, the opened tickets per day and I am using a linear fit for both. Both r² values are around 15% and the p-values are pretty bad as well (way above 5%). I wonder if I …
Category: Data Science

get_the_post_thumbnail() title and alt attributes not displaying

I am attempting to display 'alt' and 'title' attributes on a post thumbnail image, but the only attribute that actually displays as passed is 'class'. 'alt' and 'title' are missing. Any ideas what could be the cause? $thumbnail_id = get_post_thumbnail_id( ); $image_alt = get_post_meta($thumbnail_id, '_wp_attachment_image_alt', true); echo $image_alt; //correct alt attribute text echo get_the_post_thumbnail($post->ID, 'post-thumbnail', ['class' => 'classTest'] ); //works echo get_the_post_thumbnail($post->ID, 'post-thumbnail', ['alt' => 'altTest'] ); //doesn't work echo get_the_post_thumbnail($post->ID, 'post-thumbnail', ['title' => 'titleTest'] ); //doesn't work <img width="940" …
Category: Web

Post/Page Publish/Update button not clickable once I make an edit

I open a page and make an edit and the update button becomes grayed out. I have to copy all page content, refresh the page and paste it back in the page, only then does the update button become clickable. It does update the page so there is no issue with that. Only when making the initial edit is in not clickable. Update: I was able to recreate the issue, but not faithfully. It seems to occur when the page …
Category: Web

Predicting word from a set of words

My task is to predict relevant words based on a short description of an idea. for example "SQL is a domain-specific language used in programming and designed for managing data held in a relational database" should produce words like "mysql", "Oracle", "Sybase", "Microsoft SQL Server" etc... My thinking is to treat the initial text as a set of words (after lemmatization and stop words removal) and predict words that should be in that set. I can then take all of …
Category: Data Science

Getting a List of Currently Available Roles on a WordPress Site?

When writing WordPress plugins there is often a need to set up options for which roles on the site have access to certain functionality or content. To do this a plugin dev needs to fetch the list of roles that exist on the site to use in the option. Because custom roles can be created we cannot assume the default roles are the only ones available. What is the best way to fetch the list?
Category: Web

How to echo a plugin's function into a template?

I've tried checking for a similar question but couldn't find one. If possible please link me to this as I might be creating a duplicate. Anyways.. I am using a basic testimonial plugin (Clean Testimonials) and wish to create a custom template which it allows. The only things I like to add are the the_client() and the_website() functions. But the the_website() function isn't displaying? <div class="su-posts su-posts-default-loop"> <?php // Posts are found if ( $posts->have_posts() ) { while ( $posts->have_posts() …
Category: Web

What is "main query"?

Possible Duplicate: How to know which one is the main query? I'm curious to know what is the so called "main query"? What I have is two queries on front page. if (have_posts()) : while (have_posts()) : the_post(); // do the main loop endwhile; endif; $posts = new WP_Query(array('post_type' => 'some_other_post_type')); while ($posts->have_posts()) : $posts->the_post(); // do the secondary loop // but still operating with the some_post_type endwhile; wp_reset_postdata(); And what I want is just to modify the main query …
Category: Web

Setting an expiration date for wordpress roles

I need to know if there is any manual way to set expiration date for a given role. In my website, when a person purchases a video, they are assigned a role. What I am looking for is to restrict this role to 30 days. Meaning that this person has access for this restricted content during 30 days, after that, they will go back to "subscriber" with no further access to the video he purchased. Thank you and regards Liliana …
Category: Web

How to build a symmetric similarity model on top of embeddings?

I have two equal length vectors that come out of two identical embedding layers. I want to calculate their similarity, and I don't trust the embedding layer enough to just use dot product (e.g. it's plausible that different coordinates are dependent wrt overall similarity). I want to learn this using examples of good and bad pairs, without actually learning the initial embedding. What I'd like to do is to somehow combine the two vectors using another layer, and then connect …
Category: Data Science

Multi-task reinforcement learning with different action spaces

I'm currently working on a project in which I need apply multi -task reinforcement learning. Over the same state space, each agent aims to do a separate task, but the action spaces of agents are different from each other. I thought IMPALA would be a good choice at first glance, but it requires actions to be shared somehow, which is not applicable in my case. Can someone please give me an idea if there is an appropriate multi-task reinforcement learning …
Category: Data Science

Custom post type permalink missing /post_type/ front

I have a custom post type: register_post_type( 'tour', [ 'labels' => [ 'name' => __( 'Tour shows' ), 'singular_name' => __( 'Tour show' ) ], 'public' => true, 'menu_icon' => 'dashicons-tickets-alt', 'has_archive' => 'tour', // also tried true 'with_front' => true, 'exclude_from_search' => true, 'taxonomies' => ['post_tag'], 'rewrite' => ['slug' => 'shows-on-tour'], 'supports' => ['title', 'editor', 'thumbnail'] ] ); (this has been butchered a bit while trying to make it work) I'm having an issue where by when I do …
Category: Web

How to match a corpus with a string of words using a TF-IDF matrix?

I am trying to match strings of words with a website that has bulletpoints whose text is most similar to it. The way I thought of doing it is to get all of the documents from each bulletpoint into one corpus per website, that I would like to match a string of words with, discard stop words, and then lemmatize everything. Then, for each string of text, I create a TF-IDF sparse matrix, with each row the text from a …
Category: Data Science

Why is Google Search Console getting X-Robots-Tag noindex?

As can be safely inferred from the question, I'm trying to get Google to index my site. I'm using Wordpress 5.9 served by nginx (1.13.12), with SEOPress (5.6 up-to-date). I let the wizard guide me for the settings and created a sitemap that I registered with Google Search Console - as advised. I let Google do its work and came back later to check, and found that every page exposed in my sitemap returns a noindex meta (X-Robots-Tag with User-Agent …
Category: Web

Get shortcode attribute value to another function

I am trying to get shortcode attribute value to another function to add inline style.I want to use $color's value to another function. Here is my code <?php /** * */ class MakeShortcode { public $color; public function __construct() { add_action( 'init', array($this, 'PostBLock') ); add_shortcode( 'PostBLock', array($this, 'getpostblock') ); add_action( 'wp_enqueue_scripts', array( $this, 'inlinestyle') ); } public function getpostblock( $atts ){ extract( shortcode_atts( array( 'section_color' => '#000000', ), $atts) ); $this->color = $section_color; $output = 'First LIne'; $output .= …
Category: Web

How propagate the error delta in backpropagation in convolutional neural networks (CNN)?

My CNN has the following structure: Output neurons: 10 Input matrix (I): 28x28 Convolutional layer (C): 3 feature maps with a 5x5 kernel (output dimension is 3x24x24) Max pooling layer (MP): size 2x2 (ouput dimension is 3x12x12) Fully connected layer (FC): 432x10 (3*12*12=432 max pooling layer flattened and vectorized) After making the forward pass, I calculate the error delta in the output layer as: $\delta^L = (a^L-y) \odot \sigma'(z^L) (1)$ Being $a^L$ the predicted value and $z^L$ the dot product …
Category: Data Science

Pull in posts using post meta for REST API

So I wasn't able to find much detail about this, so I wanted to ask the community to see if I can get an answer. So let's say that I have the following: $this->global_endpoint = 'https://example.com/wp-json/global/v1/posts` which is the REST API endpoint for pulling in posts for WordPress. Then I am calling wp_remote_request such as this: $response = wp_remote_request(add_query_arg( [ 'page' => 1, 'per_page' => 3, 'post_status' => 'publish', ], $this->global_endpoint)); Does anyone know if it's possible to get a …
Category: Web

Escape when echoed

I've been trying to submit a plugin for review and I keep having problems with the echo line. The last version I sent was like this. <option value=""> <?php _e( '- Default', MF_TEXT_DOMAIN ); ?> </option> <?php foreach ( $folders as $folder ) { $folder = trim( $folder ); $folder = esc_attr( $folder ); echo "<option value=\"{$folder}\">{$folder}</option>"; } ?> And the WordPress response was: This is not escaped: echo "<option value=\"{$folder}\">{$folder}</option>"; $folder MUST be escaped when it's echo'd. Now I'm …
Category: Web

Change Dropdown jQuery to show/hide but with default place holder that shows all

How to set the jQuery so if default "Department" is selected show all, and only hide all else one other section made. for example, if non selected will be "Department", if "Department 1" selected only show "Department 1" and same with other options. code <script> jQuery(document).ready(function ($) { $("select").change(function () { $(this).find("option:selected").each(function () { var optionValue = $(this).attr("value"); if (optionValue) { $(".box").not("." + optionValue).hide(); $("." + optionValue).show(); } else { $(".box").hide(); } }); }).change(); }); </script> <div> <label> <select> <!-- …
Category: Web

How to list all external URLs that I have posted on my WordPress blog?

I want to list all the external links of my posts in a single place/file. How can I achieve this? Is it possible to achieve this via a plugin? Is it possible to achieve this with a built-in wordpress api? Is it possible to achieve this via some free 3rd party tool? What approach should be followed for achieving this?
Category: Web

Clean/filter HTML inserted to post content by XML RPC

An external service that uses XML RPC to publish some posts on my site adds some unwanted CSS styles and HTML to the post content. I would like to clean it up using a HTML cleaner that I've built based on DOMDocument and DOMXPath. My only question is how can I access the post_content before it is actually saved to the databse so I can run my cleaner on it? Perhaps there is a filter/action that I can use?
Category: Web

ValueError: y should be a 1d array, got an array of shape () instead

I'm using a reviews data and trying to apply classifier model and get prediction. Here is the code i'm trying. dataset = pd.read_csv('Scraping reviews.csv') import numpy as np X = np.linspace(0, 2*np.pi, 8) y = np.sin(X) + np.random.normal(0, 0.4, 8) X = X.reshape(-1, 1) from sklearn.feature_extraction.text import CountVectorizer count_vect = CountVectorizer() X_train_counts = count_vect.fit_transform(dataset) #X_train_counts=X_train_counts.reshape(4,1) X_train_counts.shape [out] (2,2) from sklearn.feature_extraction.text import TfidfTransformer tf_transformer = TfidfTransformer(use_idf=False).fit(X_train_counts) X_train_tf = tf_transformer.transform(X_train_counts) #X_train_tf=X_train_tf.reshape(4,1) X_train_tf.shape [out] (2,2) tfidf_transformer = TfidfTransformer() X_train_tfidf = tfidf_transformer.fit_transform(X_train_counts) #X_train_tfidf=X_train_tfidf.reshape(4,1) X_train_tfidf.shape …
Category: Data Science

Order posts by custom field and if custom field is empty return remaining posts

I have an archive page ordered by a numeric value in a custom field. This returns the ordered posts correctly, but does not display posts that don't have a custom field. $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; query_posts("paged=$paged&cat=7&posts_per_page=24&meta_key=custom_order&orderby=meta_value_num&order=ASC"); What is the best way to return the ordered posts correctly, followed by any posts that do not have a custom field value associated with them? Edit: Just to elaborate -- The final result that I want to accomplish is a …
Category: Web

Which statistical analysis to use when you assume non-linear model but not-specified?

I'm a psychology student/researcher and looking to model a phenomenun in which there are 3 variables. The relation of these variables are exactly unclear but I assume these variables are non-linear in nature, which means I shouldn't use linear regression or correlation analsis (let's say, the motivation for studying, the results of tests, and the sense of accomplishment, for people with dyslexia). However, since I don't have data at my hands the nature of the data distribution is unclear. I …
Category: Data Science

About

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