Set a post expiration and delete a post when expirate

I'm trying to create a function that allows me to delete an article when the date of the day is equal or superior than a date filled in a custom ACF field. I wrote the function below that I placed in my single.php in order to test it. It works, except that you must be reading the article in question for this function to execute (pretty logical actually). What I want is that this function runs itself on all the …
Category: Web

Create tensor of a sequence with a defined shape using TensorFlow

Create a tensor Y of shape (2,3) having a sequence of numbers 12,15,18,...., 150 I tried using the below code tf.constant(np.arange(12,153,3),dtype=tf.dtypes.float32,shape=[2,3]) I got an error saying the tensor with 47 elements cannot be converted into 6 elements. I added the following third dimension in shape and it worked. tf.constant(np.arange(12,153,3),dtype=tf.dtypes.float32,shape=[8,2,3]) How to proceed as the given question wants the sequence tensor to be in shape [2,3]? Please help.
Category: Data Science

Removing fields from the Media Uploader/Gallery

I've been searching high and low for an answer. I simply want to remove the Alternate Text, Caption, Description and Link URL-fields from the uploader and gallery view. I seem that every thing else than this Media-thingy can be removed. Thanx for helping out:)
Category: Web

Using CNNs to detect incorrect label images in dataset

What I want to do is to train a model to identify the images that are incorrectly labeled in my dataset, for example, in a class of dogs, I can find cats images and I want a model that detects all those images that are in the wrong class. Does any one tried this to have more details or does any one have any ideas? I'm open for all ideas and thank you in advance.
Category: Data Science

Aggregated probability based on multiple predictions on independent samples using the same classifier

i have a understanding question regarding the interpretation of a aggregation of a machine learning classifier. Lets assume i have trained a binary classifier and it was validated with a accuracy of 70% (dataset is always balanced). My question is now, if this probability seems to low for me - and i would search for ways to improve that without any readjustments on the classifier - would the following idea be valid?: The classifier predicts three independent samples (always with …
Category: Data Science

How can I test the relationship between events and categorical data

I have a dataset comprised of mostly categorical data, in particular, different name tags of events that happen within a process. Those are accompanied of their timestamps and there are hundreds of unique tags. I also have some shutdown events that happen regularly within said process, in my data, I have around 50 registered shutdowns. Which method can I use to try to identify which tags are influencing the shutdown?
Category: Data Science

The single CSV created by combining a large number of CSV files is too large to process. What options do I have?

The dataset I am currently working on has more than 100 csv files, with each of size more than 250MB. These are files containing time series data captured from different locations and all the files have the same features as columns. As I understand, I must combine these into one single csv file to use these data in a CNN, RNN or any other network and its assumed to be more than 20GB after completion. But this is an unacceptable …
Category: Data Science

Custom Widget WP_Query problem

I have everything working on my widget except the results! I created a taxonomy called country names that we use for several custom post types. I created this widget to display tour guides (CPT) from the selected country. The widget is working properly on the back end, but I am getting no results on the front end (ie. "No listing found"). I have echoed the $instance to the screen and it is correct, so my args or query must be …
Category: Web

Admin slow on Postlist (over 30k Posts in Database)

we have a Site with around 20k Posts in the normal postlist and another 10k in other CPT. The custom post types work really fast, but the normal Post List doesn't. I assume that might be because the server aggregates how many posts are published, how many are mine and how many are deleted, but I'm not really sure about that. Any idea how to limit what is being queried - I looked in google how to remove sections from …
Category: Web

specificity for 3 class

I was reading an answer in qoura to calculate the specificity of a 3 class classifier from a confusion matrix. In the below answer https://www.quora.com/How-do-I-get-specificity-and-sensitivity-from-a-three-classes-confusion-matrix For below 3-class confusion matrix, The below is a screenshot from the answer. the sensitivity and specificity would be found by calculating the following: My question is in numerator for specificity which is false negatives shouldnt it be 4 terms. Eg if we are calculating w/r 1, Then in the table n22,n33,n32 and n23 were …
Category: Data Science

How to show a message to a user?

From a plugin how can I show a message to a user? Specifically I'd like to show a message to any user after comment submission indicating that their comment was submitted. My thought was to hook into the comment_post action. However in searching for this I could not find an answer to the more general problem of how to show a message to a user. The message should be shown to the user a single time regardless of whether they …
Category: Web

WordPress Rest API - Get all posts based on post_meta on custom endpoint

So I can't seem to figure out how to get ALL posts based on a specific post meta, so I wanted to reach out and see if someone might be able to assist. What I am trying to achieve: I have website A, which has posts that I can access using /wp-json/wp/v2/posts which outputs ALL posts on the website. Then I have website B which I want to access website A posts, but I want to pull in only specific …
Category: Web

does KNN have a hypothesis space? if yes, Is there a way to clearly define the hypothesis space with the instances?

I am learning this post, "A few useful things to know about machine learning" The author says A classifier must be represented in some formal language that the computer can handle.Conversely, choosing a representation for a learner is tantamount to choosing the set of classifiers that it can possibly learn. This set is called the hypothesis space of the learner. and put KNN and SVM in the instance-based category. I assume the instance here mean each individual example, for instance, …
Category: Data Science

Add the same content to multiple pages

I have a website with over 500 pages. Dont ask why but none of these pages have any content in them. I have created a page layout to be added as a single wp bakery block and want to add this same block to all pages but I cant see a way of doing this without going through everypage and doing it manually. Am I missing something?
Category: Web

How to change text color depending on the number value (Using javascript)

I'm trying to change text on the table depending on the meta value I give (number). if meta value >= 7, number text on table changes to green. else if meta value >= 4, number text on table changes to yellow. else, number text on table changes to red. However, this code doesn't work. <script type="text/javascript"> function change_color_text (num1) { var rate_num = num1; if(rate_num >= 7) { rate_num.style.color = "green"; // green } else if (rate_num >= 4) { …
Category: Web

Feature extraction from relational database

In order to build a classifier, I need to extract a few features from the data stored on a MySQL database. I need to join multiple tables and it is taking a lot of time. I have joined 2 tables at one time and have got results in multiple cases. I need to combine them. Writing a script will be the best option? How do people extract features from large relational databases? Am I missing something? Thanks.
Category: Data Science

Permalinks broken regularly

On one of my sites the permalinks are broken regularly. After saving them again it's all fine but a few days later the permalinks result in not found and I have to save them again. There are no errors in the log files and I also deactivated all plugins which might impact rewrites/permalinks. Due to the fact that it happens over time it's hard to see if maybe a plugin is causing the issue. Any idea?
Category: Web

Restrict users of site 1 to login in site 2 in wordpress multisite

I'd setup Wordpress Multisite. site-1: www.abc.com (is main site). site-2: www.abc.com/site2 (is a subsite). I'd setup other site in sub directory not on as a subdomain. Right now if a user register and login to site-2 it is registering on www.abc.com and can access both sites. I want to restrict the users on site-2 so if they visit site-1 they will not be logged in for that site. Also on site-1 there are some user roles. Administrator, Business Owner, Installer …
Category: Web

Evaluate Dendrogram Statistical Significance

I have N=21 objects and each one has about 80 possible not NaN descriptors. I carried out a hierarchical clustering on the objects and I obtained this dendrogram. I want some kind of 'confidence' index for the dendrogram or for each node. I saw many dendrograms with Bootstrap values (as far as I understand it is the same as Monte Carlo Cross-Validation, but I might be wrong), and i think that in my case they could be used as well. …
Category: Data Science

Estimating location in a model

I have a big dataset with 10 columns and about a 100,000 rows. Each 5 rows represent a person being tracked and the data related to this tracking such as time, velocity, etc. the last two columns are the longitude and latitude for that person. To test the model, the test set has the fifth row for each person missing in longitude and latitude. What's the best way to approach this problem? for example the test set looks like: id …
Category: Data Science

Enabled Revisions to existing custom post type not working Wordpress

I am trying to enable revisions for an existing custom post type. As the post type was already created about 2 years ago so where the post type was register I added revisions to the supports array. Earlier my code was like: $labels = array( 'name' => 'Products', 'singular_name' => 'Product', 'all_items' => 'All Products', 'add_new' => 'Add New', 'add_new_item' => 'Add New Product', 'edit_item' => 'Edit Products', 'new_item' => 'New Product', 'view_item' => 'View Product', 'search_items' => 'Search Products', …
Category: Web

error:-Cannot modify header information - headers already sent by

whewn ever i try to login http://affiliatesurge.com.au/wp-admin/ i got "" Warning: Cannot modify header information - headers already sent by (output started at /home/affiliat/public_html/wp-config.php:1) in /home/affiliat/public_html/wp-includes/pluggable.php on line 881 "" Error ... i already try removing spacing in wp-config and functions.php
Category: Web

When using optuna I should return accuracy or loss as objective value?

I am using optuna for hyperparameter tuning for my segmentation model. At the model, I am returning accuracy as an objective value since I realised that it tries to optimize to get the best result based on the objective value. I tried the same with returning (1-loss) but I am not sure what goes with either loss or accuracy when tuning. Also for loss is there another way than 1-loss to optimize or tune based on the loss curve?
Category: Data Science

What's the difference between GridSearchCrossValidation score and score on testset?

I'm doing classification using python. I'm using the class GridSearchCV, this class has the attribute best_score_ defined as "Mean cross-validated score of the best_estimator". With this class i can also compute the score over the test set using score. Now, I understand the theoretical difference between the two values(one is computed in the cross validation, the other is computed on the test set), but how should I interpret them? For example, if in case 1 I get these values (respectively …
Category: Data Science

Specific URL has 403 Forbidden status code

I'm debugging a Belgian WP website: slotenmakerbelgie.com. The problem is that I get a forbidden status on a specific URL: slotenmakerbelgie.com/error/ (with and without trailing slash at the end) I really don't understand what's going on. I already have checked the following: Temporary deleted .htaccess Temporary deactivated all plugins Checked empty folders Checked and deleted wp_old_slug_redirect Redirections WordPress settings / files / did an integrity scan (no WP files are modified and uploaded a fresh WP install) I'm really getting …
Category: Web

What is the best way to feature engineer features which have more than one repeated values?

What is the best way to feature engineer features which have more than one repeated values ? I want to parse this data and finally keep in a pandas df for further analysis. Example, I have data of people's profile which consists of Name, Age, Gender, Company, Degree Now it is easy to keep Name , age and gender which has specific single value, but company can have more than one value or multiple value like someone worked with Google …
Category: Data Science

"508 Resource Limit Is Reached" on WordPress site

I have a WordPress site that's been running perfectly since 2016, and then suddenly started having "508 Resource Limit Is Reached" problems in mid-2019. According to Awstats on my hosting cPanel, all the hits were coming from a singe IP address and the page it has been asking for is /wp-admin/admin-ajax.php It's not a website that I would expect to suddenly have a huge increase in legitimate visits that would max out the resources, so I'm assuming it's a Spambot …
Category: Web

Ways to characterize changes in sampled data beyond variance

I'm looking for ways to characterize sampled data that captures how "monotonic" changes in the data are. For example, in the function plots below, I want a measure that differs significantly for the two plots even though their variance might be roughly the same. As a further complication the computation must be performed on a very resource-constrained device, namely using less than a KB of RAM if possible. The interesting window of the data is around 300 samples wide and …
Category: Data Science

Custom post type / taxonomy rewrite archive page 2 gives 404

I've followed the code based off this and everything is working perfectly -How to create a permalink structure with custom taxonomies and custom post types like base-name/parent-tax/child-tax/custom-post-type-name So I am able to browse taxonomy archives with my/category (or) my/category/subcategory and view a custom post associated with each term as my/category/subcategory/custompost However, I cannot view my/category/page/2/ or my/category/subcategory/page/2/ It gives me a 404. Here is the code I am using. posttype.my.php function create_my_posttype() { register_post_type( 'my', array( 'labels' => array( 'name' …
Category: Web

adding a supervising process during knn process

I am trying to improve my KNN regression process (I would like to use sklearn / python, but it doesn't matter).I would like to improve my results and to gain insight. Here is an example: I have data measured from an electric motor: an input voltage (U) and current (I) and an output torque (T) and speed (S). First intend is a simple approach where I'm giving those data in the state to a KNN algorithm and I use the …
Category: Data Science

Training CNN on a huge data set

I am trying to train an AlexNet image model on the RVL-CDIP Dataset. The dataset consists of 320,000 training images, 40,000 validation images, and 40,000 test images. Since the dataset is huge I started training on 500 (per class) sample from the training set. The result is below: we can see from the graph above that the validation loss started decreasing at a much slower rate around epoch 20 while training loss continued decreasing the same. This means our model …
Category: Data Science

How can a default site icon be set in customizer?

From my research there are only two questions I've found around this topic on this site: How to change in customizer the “site identity” tab required capabilities how to change default icon of custom plugin? outside of the site I did find: How to Add a Default Site Icon in Theme's Customizer but when I try: function default_icon() { global $wp_customize; $wp_customize->get_setting('site_icon',array ( 'default' => home_url() . 'img/test.png' )); } add_action('customize_register','default_icon'); I've also tried add_setting with: function default_icon() { global …
Category: Web

About

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