Add new password rule to Ultimate Member register form

I use Ultimate Member and classic form for registration. I have enabled "Strong password", but I want my users to at least fill their password with 1 special character (like "# % $ ...") I didn't find any plugin, so I tried to find the good hook and I tried this code : function um_submit_form_register_theme($args) { global $ultimatemember; $password = $_POST['user_password-257']; if ( !isset($ultimatemember->form->errors) ) { if (!preg_match("/\W/", $password)) { $ultimatemember->classes['form']->add_error( 'user_password-257', __('Your password must a special caractere') ); } …
Category: Web

two different attention methods for seq2seq

I see two different ways of applying attention in seq2seq: (a) the context vector (the weighted sum of encoder hidden states) fed into the output softmax, as shown in the diagram below. The diagram is from here. (b) the context vector fed into the decoder input as shown the diagram below. The diagram is from here. What are the pros and the cons of the two different approaches? Is there any paper comparing the two?
Category: Data Science

Plotting decision boundary from Random Forest model for multiclass MNIST dataset

I am using the MNIST dataset with 10 classes (the digits 0 to 9). I am using a compressed version with 49 predictor variables(x1,x2,...,x49). I have trained a Random Forest model and have created a Test data set, which is a grid, on which I have used the trained model to generate predictions as class probabilities as well as the classes. I am trying to generalise the code here that generates a decision boundary when there are only two outcome …
Category: Data Science

SEO meta description and title tag Yoast SEO

I am using Yoast SEO and a custom header. this obv means that any code that yoast uses to input all the seo stuff such as title tag and meta description wont be there. I solved the title tag by using this code: <title><?php /* * Print the <title> tag based on what is being viewed. */ global $page, $paged; wp_title( '|', true, 'right' ); // Add the blog name. bloginfo( 'name' ); // Add the blog description for the …
Category: Web

Sorting Custom Posts on Archive page with pagination

I've got custom taxonomy archive pages with a drop down list that allows users to re-order/sort the posts. It basically waits for the user to select from the drop down then uses array_merge( $wp_query->query..... to create a new query and re-sort the posts. This works fine. I also use wp-pagination to display numbered pagination. This also works fine. The problem is, when a user re-sorts the list, and then clicks on the pagination to go to page 2 the new …
Category: Web

Python sklearn PCA transform function output does not match

I am computing PCA on some data using 10 components and using 3 out of 10 as: transformer = PCA(n_components=10) trained=transformer.fit(train) one=numpy.matmul(train,numpy.transpose(trained.components_[:3,:])) Here trained.components_[:3,:] are: array([[-1.43311999e-03, 1.65635865e-01, 5.49189565e-01, 5.26069645e-02, 2.42638594e-01, 1.20957807e-02, 1.30595572e-01, 1.09279646e-02, 7.21299808e-03, -2.79057934e-02, -1.14834589e-02, 5.06289160e-01, 5.42890317e-01, 8.50422194e-02, 1.80935205e-01, 2.98473275e-05, -8.04537378e-04], [-1.05419313e-02, 3.09442577e-01, -8.15534934e-02, 4.28621520e-03, 2.93323569e-01, 3.85849115e-02, -1.16193185e-01, 4.14964652e-01, 4.16279154e-01, 2.95264788e-01, 3.28620106e-01, -2.60916490e-01, -2.37459426e-02, 1.57567265e-01, 4.02873342e-01, 5.28389303e-05, -2.07920000e-03], [ 8.63072772e-03, -3.26129082e-01, 8.59869400e-02, 3.04770780e-03, -3.14966419e-01, -2.47151330e-02, 1.05987767e-01, 3.74235953e-01, 3.75747065e-01, 2.76035253e-01, 3.18273743e-01, 3.02423861e-01, 2.76535177e-02, -1.51485057e-01, -4.48558170e-01, -8.83328996e-05, -2.25542180e-03]]) and using only …
Category: Data Science

Showing the authors username and bio on custom author.php

I have this code I'm using to create a custom author.php, which is working great to show that users posts and it's children etc: <?php get_header(); ?> <?php $curauth = (isset($_GET['author_name'])) ? get_user_by('slug', $author_name) : get_userdata(intval($author)); ?> <div class="auth-name"> <?php if ( '' != get_the_author_meta( 'user_description' ) ) echo apply_filters( 'archive_meta', get_the_author_meta( 'display_name' )); ? > </div> <div class="auth-desc"> <?php if ( '' != get_the_author_meta( 'user_description' ) ) echo apply_filters( 'archive_meta', get_the_author_meta( 'user_description' )); ?> </div> <div class="header"> <h1>Buckets made …
Category: Web

What ML architecture fits fixed length signal regression?

My problem is of regression type - How to estimate a fish weight using a fixed-length signal (80 data points) of the change in resistance when the fish swim through a gate with electrodes (basically 4 seconds of the fish passing at 20Hz logger)? It is a spike shaped-signal, height and width depend on the size of the fish, its speed and proximity to the edges of the gate and probably other things like the water salinity and temperature. I …
Category: Data Science

Previewing/Updating some Pages causes "The requested URL was rejected" Error

The wordpress site is suddenly having a problem where on some (not all) of the pages, when you click preview page or update changes it gives an error message: "The requested URL was rejected. If you think this is an error, please contact the webmaster. Your support ID is: 9641638102880218190" This can be circumvented by entering the preview url directly into the browser or clicking "open in new tab" when you click the preview button. However you cannot right click …
Category: Web

How to get full native language instead of iso?

I am not using WPML or Polylang, but multisite to create multiple languages. The code below is used to make a language switcher, but I want a second menu with the full language name for a different menu (i.e. EN should be English, FR - Français, DE - Deutsch). Wordpress has the native names stored (because when selecting a language you get a list with the native language name), but how can I access this to use? $languages = get_available_languages(); …
Category: Web

change attachment custom field onChange event

The form is in post creating window. Ajax is posting values, but the values doenst renews. Where can be problem ? Ajax <script> function dynamic_Select(field, aid, value) { console.log(field, aid,value); jQuery.ajax({ type: "POST", url: ajaxurl, data:{ field: field, aid: aid, value: value, }, error: function(){alert('Error!')}, success: function(){alert(value)} }); } </script> functions.php add_action('wp_ajax_dynselect', 'update_dynamic_select'); add_filter("attachment_fields_to_save", " update_dynamic_select", null , 2); function update_dynamic_select($field, $aid, $value) { update_post_meta($aid, $field, $value); } HTML: <select aid="104" name="_image_matmenys" onchange="dynamic_Select(this.getAttribute('name'), this.getAttribute('aid') ,this.value)"> <option value="10x10">10x10</option> <option value="20x20" selected="selected">20x20</option> …
Category: Web

Is summing a cosine similarity matrix a good way to determine overall similarity?

I'm trying to similar research abstracts, so I'm using word embeddings to convert words into 1x768 vectors, so overall turning abstracts into embeddings with shape (#ofwords, 768). Cosine similarity between two abstracts returns a matrix (#ofwords1, #ofwords2), which I then sum up to get an overall score. What I'm wondering is if this summing up of all the values in a cosine similarity matrix is really a good way to determine overall similarity between two different texts? Is there a …
Category: Data Science

Clustering algorithm for time series data with categorical dtypes

I have a large dataset with around 200 features, consisting mostly of timeseries and categorical data, with some continuous. The dataset is extracted from/by a postal service. Small example: Random (scrambled) entries: shipment delivery cost location weight_kg 2020-04-22 2020-04-23 77.31 UK:66c54f531.... 0.5 2020-04-23 2020-04-25 44.14 DK:22c54f531.... 2.23 2020-04-24 2020-04-27 53.84 UK:66c54f531.... 1.57 2020-04-25 2020-04-26 22.09 UK:66c54f531.... My first inclination was to make a demand-forecast model on shipment/count_monthly(shipment), but considering the amount of features, a multivariate case seemed more relevant. I …
Category: Data Science

How do I fix "Sorry, this file type is not permitted for security reasons"

When I try to upload any PNG file, I get the following error message: I have no plugin or anything installed, that could cause this. I even added the following line in order to fix this: define('ALLOW_UNFILTERED_UPLOADS', true); Since it is a local installation, security is not an issue. But still this didn't fix my problem. Any ideas what could cause this problem?
Category: Web

Multiple regression (using machine learning - how plot data)

I wonder how I can use machine learning to plot multiple linear regression in a figure. I have one independent variable (prices of apartments) and five independent (floor, builtyear, roomnumber, square meter, kr/sqm). The task is first to use machine learning which gives the predicted values and the actual values. Then you have to plot those values in a figure. I have used this code: x_train, x_test, y_train, y_test = tts(xx1, y, test_size=3) Outcome: LinearRegression(copy_X=True, fit_intercept=True, n_jobs=None, normalize=False) regr.fit(x_train, y_train) …
Category: Data Science

Sticky header for wordpress changes size and logo size as I scroll down

I am using Themify to construct my website. I have a parallax site partially constructed, however when I scroll down my logo and header changes size. It is a sticky header and goes from being transparent to a color. Where can I find the options to change this in the themify builder? I just want to keep the size consistent as I scroll down. Here is the site: http://willwiseman.us
Category: Web

TextVectorization and Autoencoder for feature extraction of text

I'm trying to solve a problem which is as follows: I need to train the autoencoder to extract useful data from text. I will use the trained autoencoder in another model to extract features. The goal is to teach the autocoder to compress the information and then reconstruct the exact same string. I solve the problem of classification for each letter. My dataset: X_train_autoencoder_raw: 15298 some text... 1127 some text... 22270 more text... ... Name: data, Length: 28235, dtype: object …
Category: Data Science

A toolbox with code for context free grammar verificiation for logical formulas

I work with Linear Temporal Logic (LTL) formulas. I am looking for a toolbox to verify if an LTL formula can satisfy a given Context-Free Grammar (CFG). For example, we have the LTL formula G(x_1>0). In that LTL formula, G is the temporal operator always (or globally), and x_1 is the first mode of a finite trajectory of binary values. For example, x:=1,0,1; 1,1,1; 1,1,0. This trajectory satisfies G(x_1>0) because x_1 (the first mode) is alsway true (the first mode …
Category: Data Science

How does the construction of a decision tree differ for different optimization metrics?

I understand how a decision tree is constructed (in the ID3 algorithm) using criterion such as entropy, gini index, and variance reduction. But the formulae for these criteria do not care about optimization metrics such as accuracy, recall, AUC, kappa, f1-score, and others. R and Python packages allow me to optimize for such metrics when I construct a decision tree. What do they do differently for each of these metrics? Where does the change happen? Is there a pattern to …
Category: Data Science

WP rest api returns 404 only when author param is used

I have a multisite wordpress installation on aws linux, working perfectly fine. The WP Rest api is also working exactly as it should. Except for one single case. /wp-json/wp/v2/posts?author=<some int> For everything else, including my custom endpoints, and custom params/fields added to the api, it works perfectly. But the moment i add the author part, it returns 404 on all sites. eg: /wp-json/wp/v2/posts?author_exclude=1 //this works /wp-json/wp/v2/posts?page=2 // this also works /wp-json/wp/v2/posts?page=2&author=abc // this also works and returns invalid author /wp-json/wp/v2/posts?page=2&author=1 …
Category: Web

Decomposing R squared or VIF

In the context of multi-regression, I am wondering if there is a way to decompose $$VIF_i = 1/(1-R_i^2)$$ where $R_i^2$ is the r squared obtained from the regression of dependent variable = i and independent variables are all other factors. I want to decompose $VIF_i$ or $R_i^2$ into individual factors to see how much each individual factor contributes to the $VIF_i$ or $R_i^2$ Someone recommended using the square of partial correlation coefficient and that value is linearly related to $R_i^2$. …
Category: Data Science

Rewrite nested urls for custom post type

I have a problem with nested permalink. I have a structure of urls like that: Catalog -> Category -> Product My urls are: www.domain.com/catalogs (for archive catalog) www.domain.com/catalogs/%catalog% (for single catalog page with the list of categories) www.domain.com/catalogs/%catalog%/%category% (for single category page with the list of products) www.domain.com/catalogs/%catalog%/%category%/%product% (for single product page) In the WP Backoffice and Frontoffice all url are correct, the only problem that I have is when I visit the product page, for example: www.domain.com/catalogs/catalog-001/category-001/product-001 There I …
Category: Web

Initializing weights that are a pointwise product of multiple variables

In two-layer perceptrons that slide across words of text, such as word2vec and fastText, hidden layer heights may be a product of two random variables such as positional embeddings and word embeddings (Mikolov et al. 2017, Section 2.2): $$v_c = \sum_{p\in P} d_p \odot u_{t+p}$$ However, it's unclear to me how to best initialize the two variables. When only word embeddings are used for the hidden layer weights, word2vec and fastText initialize them to $\mathcal{U}(-1 / \text{fan_out}; 1 / \text{fan_out})$. …
Category: Data Science

I want to loop thro owl carousel in wordpress i used this code but nothing works

<div class="container"> <div class="row"> <div class="col-md-12"> <div class="owl-carousel" id="product-slider"> <?php while ($loop->have_posts()): $loop->the_post();?> <div class="product"> <?php $loop = new wp_Query(array( 'post_type' => 'home_producten', 'orderby' => 'post_id', 'order' => 'ASC', ));?> <?php if (has_post_thumbnail()) { // check for Image the_post_thumbnail();}?> <h3 class="title"> <?php the_title();?> </h3> <p class="description"> <?php the_content();?> </p> <a class="btn btn-warning text-uppercase" href="<?php the_permalink();?>"> See More </a> </div> <?php endwhile;?> </div> </div> </div> <!-- ==== END OF CAROUSEL ===== -->
Category: Web

Applying filters to custom objects in an image

I would like to create an application that adds image filters (Snapchat-style) to photos of cats or chairs (just for the sake of this question). In order to do that properly, I thought of using Active Shape Modelling algorithms to have a model to apply the filters to. I trained an object detection model to identify those items in an image (yolov5), so I now have a bounding box around each item, but I still don't know its exact shape …
Category: Data Science

Cable angle measurement (rotation)

I need to detect the rotation of a cable (degree) in the x-axis with high precision [0.2 (or more) degree detection] from its original state. Detailed description: I have a cable that is set in its original state. The system has rotated the cable in the x-axis. I want to know the degree the cable has been rotated from its original state. Example: There're following images for a specific cable in different rotation (angle) [0, 0.4, 0.6, 0.8]: 1) 2) …
Category: Data Science

How to display dynamic content in start_lvl function

I am creating a custom nav walker but having trouble outputting parent menu item title in start_lvl function. I want to output it right after the <div class="dropdown"> in the following start_lvl function. function start_lvl(&$output, $depth = 0, $args = array()) { $indent = str_repeat("\t", $depth); if ($depth == 0) { $out_div = ' <div class="dropdown-wrapper"><div class="dropdown">This is where I want to output parent item title'; } else { $out_div = ''; } // build html $output.= "\n" . $indent …
Category: Web

How to disable Page Preview on sidebar in Page Editor in backend of wordpress?

I'm trying to update this contact page and it's not letting me click "update" because it's forcing me to fill out the form. When I do a test in the required fields, it's giving me an error. Therefore, I am not able to update the page. Is there a way to disable the preview in the sidebar? This is so frustrating! Side note - I did not build this site. It's awful.
Category: Web

pdf to json libraries

I am looking for a library which converts pdf to json. Basically in that json the paragraph heading is the and the value is the content of paragraph. Is there any python library for that ? I am already using pdfminer but that just converts to plain text. It cannot persist the structure/organisation of the document. For now it is ok to not read images and table although if there is a library to do that would be great.
Topic: nlp
Category: Data Science

manage_edit-{post_type}_sortable_columns sorts, but wrong!

Good afternoon! This is an issue regarding the Wordpress backend and custom post types. I have spent all Friday searching and trying possible solutions and, while they helped others, in my case they're not doing what I need. Status quo I have a custom post type called "anco_project" it uses very few WP given data-fields but more custom ones from the ACF addon including a field called "anco_project_year_from" and one called "anco_project_year_to", both set up as a 'true number' format. …
Category: Web

Duplicate Custom Post Type and Taxonomy Slug

I've seen a few questions that are very similar, but I haven't been able to get an exact answer, so I'm going to explain my situation here. Quite simply, I need the following url structure: site.com/dining (custom post type) site.com/dining/restaurants (terms of custom taxonomy) site.com/dining/specific-location (actual post of the custom post type) This url structure will be repeated for multiple custom post types, such as lodging (terms of hotels, inns, B&B, resorts, etc), Bars, etc. My current setup is: Custom …
Category: Web

confusing regarding to kmeans clulstering for data correlation

I am trying to think through my process before doing any real coding. However, got really confused easily. Say I have 100 instruments and I know their price movements every day for a year. So I can create a movement matrix A =[[I1-1, I2-1, .... I100-1], (I1-1 is price for instrument 1 on day 1) [I1-2, I2-2, .... I100-2], .... [I1-365, I-2365, .... I100-365] ] Then for each instrument, I can calculate a price movement correlation between other instruments 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.