Is there are way to impute missing values by clustering, regression and stochastic regression

I'd like to know if there are any libraries that allow imputation by clustering, regression and stochastic regression. So far, I've done imputation by mean, median and KNN. I'm trying to evaluate the best imputation method for an small dataset (Iris in this case). I had to delibrately create NaN values since Iris set has none. My code for KNN imputation: import pandas as pd import numpy as np import random from fancyimpute import KNN data = pd.read_csv("D:/Iris_classification/train.csv") mat = …
Category: Data Science

Display list of only specific tags on product

Good afternoon, I know I'm doing this wrong, looked at all the other questions but can't get it figured out. I have a tag list with images assigned that are displayed in a separate area of my site. I don't want to display all the tags assigned to the product, only the specific tags; they are TAG1, TAG2, and TAG3. I attempted to put the below <<< >>> in to see if it would work but to no avail. My …
Category: Web

How should I sample my validation set if I randomly sample training data?

I have: training dataset of size 150k. validation dataset of size 19k. At each epoch I randomly sample without replacement 10k datapoints for training because I get Out of Mem Errors. I need to downsample my validation set too. Which of the following methods seem most appropriate: Randomly sampling validation set which is x% of 10k and use the same set across every epoch. Randomly sampling validation set which is x% of 10k at every epoch.
Category: Data Science

Localhost WordPress Uploading of Images Issue

I'm a bit stuck here. My Mac (running Mavericks) died on me last week, and I spent the weekend getting a new computer and restoring the backup of my old (thank God for backups people. If you haven't made one, go do it.) The new computer runs Yosemite. I had a pretty great system set up on my old computer that I was REALLY happy with for running local installs of WordPress via a single installation without using WPMU. I …
Category: Web

Problem with batching tensors - InvalidArgumentError: Cannot batch tensors with different shapes in component

So, I am trying to build this model for an image classifier using the oxford flower dataset 102, and I am having issues when trying to fit the model. The error says: InvalidArgumentError: Cannot batch tensors with different shapes in component 0. First element had shape [500,667,3] and element 1 had shape [500,528,3]. [[node IteratorGetNext (defined at <ipython-input-23-4e2ec1874986>:7) ]] [Op:__inference_train_function_36111] Function call stack: train_function I am struggling with this for quite some time but I really cannot fix it. I …
Category: Data Science

Troubleshooting "loopback requests that take too long"

So I am dealing with this dreaded "unable to edit php files" errors after updating to 4.9.1 I disabled all of my plugins, and I am still getting the following error though the Health Check plugin: The loopback request to your site took too long to complete, this may prevent WP_Cron from working, along with theme and plugin editors. Which is great to know! Because apparently that is the cause of the error that I receive when I try to …
Category: Web

Jquery no more loading, load-scripts.php not found (404)

When I open my wordpress website admin panel jquery is not working anymore (it worked yesterday and I don't see what I changed that can explain that). The first javascript error I have is GET https://mywebsite/wp-admin/load-scripts.php?c=0&load%5B%5D=jquery-core,jquery-migrate,utils,underscore,wp-util,wp-sanitize,wp-a11y,updates,jquery-ui-core,jquery-ui-widget,jquery-ui-mouse,&load%5B%5D=jquery-ui-sortable&ver=5.2.4&__sbCache=0.6882317019003932 net::ERR_ABORTED 404 And if I try to open https://mywebsite/wp-admin/load-scripts.php the page is not found. However the page exists in /wp-admin on my ftp. If the file exists how it can't be found ? If I rename the file into test.php and call mywebsite/wp-admin/test.php it …
Category: Web

Removing delete permanently button in uploading files media

How do I delete or remove the word Delete Permanently in uploading files? I wanted to remove this permanently so that the users won't keep deleting files which are not supposed to delete. I use this code: .button-link.delete-attachment{display:none} But the problem of this, if the user uses the inspect element, they can just change it to display:block to show the delete button. Using CSS is not an option. Is there a function code here to remove this? Or where can …
Category: Web

Advantages and disadvantages of using softmax/sigmoid and categorical_crossentropy/binary crossentropy for a binary classification with a CNN

I'm doing a deep learning model using tensorflow and keras. I have a question about the output architecture. I want to classify between two classes, images with defects and images without defects, I've built a CNN based on VGG16 but smaller. The problem is basically a binary classification.It's possible to use one unique neuron on the output using the sigmoid activation and the binary crossentropy function as loss. The other option is to use two neurons, using softmax and categorical …
Category: Data Science

Unable to debug where torch Adam optimiser is going wrong

I was implementing a training loop in vscode. I have created a Adam optimizer using XLM-Roberta model as follows: xlm_r_model = XLMRobertaForSequenceClassification.from_pretrained("xlm-roberta-base", num_labels = NUM_LABELS, output_attentions=False, output_hidden_states=False ) xlm_r_model.to(device) optimizer = torch.optim.Adam(xlm_r_model.parameters(), lr=LR) Then at following line: optimizer.step() vscode simply terminates the execution, without any error stack trace. So I debugged to get to know exactly where this is happening. I reached this line, which makes F.adam(...) call: Weirdly, on github, torch.optim.adam does not have this line. It seems that …
Category: Data Science

Custom recurrence not working / Wp Cron event

I created a wp cron event with a custom interval of 5 minutes, but it is only executed hourly instead of every 5 minutes. (The callback is properly executed.) The DISABLE_WP_CRON constant is set to true, wp-cron.php is called via crontab every 5 minutes. (https://developer.wordpress.org/plugins/cron/hooking-into-the-system-task-scheduler/) No errors in debug.log (WP_DEBUG set to true). I created my plugin with the wordpress plugin boilderplate generator (https://wppb.me/). My code (in class Wp_Goldprice_Activator, function activate()): function fetch_metal_prices_recurrence( $schedules ) { $schedules['every_five_minutes'] = array( 'display' …
Category: Web

Hierarchical Clustering and Variable Selection

I am using "Single linkage" hierarchical algorithm to cluster my data points with Gower Distance as my data have both qualitative and quantitative variables. After applying this for the full model (all variables) I would like to start excluding those variables which are actually the not so important for my data. I was thinking of using principal component analysis (PCA) but I can't because my variables are a mixture of both categorical and continuous. Can someone suggest what is best …
Category: Data Science

WP Optimization: Removing Orphaned wp_options (especially the autoload ones)

Is there no mechanism which purges old options from the DB? I tried a few plugins in the past and I found out that there are a few pretty long option strings which are set to autoload but IMHO not used at all - as I'm not using those plugins anymore. So I guess it makes sense to remove those options completely - but I'm not 100% sure whether I miss some implications? Am I mistaken, or this the unfortunate …
Category: Web

Redirect sub-page URLs to parent without changing URL

I am having an issue with redirect rules for a single-page app that is on a sub-page of a Wordpress site. I have followed this set of instructions pretty directly and am still having issues: Redirect sub-pages to parent without changing URL The subpages are custom post types for business locations. When someone visits http://business.com/hollywood-ca/contact it should pull up http://business.com/hollywood-ca/ but the url needs to remain the same (The contact portion of the URL is part of a single-page Vue.js …
Category: Web

Should I pretrain my BERT model on specific dataset if it has only one class of labels?

I want to use BERT model for sentences similarity measuring task. I know that BERT models were trained with natural language inference architecture with dataset with labels neutral, entailment, contradiction. My data to which I want to apply BERT for sentences similarity task has very specific terms and jargon, so I want to pretrain model on it before. But in that data there are only cases of entailment labels (about 20k rows). Is it a good idea to pretrain model …
Category: Data Science

Bypass "supress_filters" in WP Query

Apparently, for some illogical reason, the developers decided that the only way to fetch posts in all languages, is to add supress_filters=true to the WP_Query (instead of having like say, a language_code=all option). Anyways, I am in a situation where I need to fetch posts in all languages, but ALSO modify the WP_Query using filters. Is there a way to enforce that my filters are being added to the query, even though supress_filters is set to false? This is the …
Category: Web

ML Approach for Getting List of Observations with Similar Features (Discrete+Continuous)

I have a dataset with 19k observations. Each has approximately 448 features: - Text description turned into vectors of size 300 - 16 categorical variables represented numerically - The remainder are quantitative features Each observation also has a list pointing to 10 other observations (from the 19k) that it's most similar to. I want to train an ML model that can understand how the 448 features contribute to this "similarity". Once the model understands that, it could accurately pick the …
Category: Data Science

Single scalar from vector

I am aware that this question is very general, but I found this question and it made me curious. What are the sensible ways that you can think of to derive a single scalar value from a vector? Of course this procedure will vary a lot according to your data and your purpose and will result in an information loss, but what are the alternatives? For now, this is what I have (from linked question and mine): Length. Compute the …
Category: Data Science

Training data for anomaly detection using LSTM Autoencoder

I am building an time-series anomaly detection engine using LSTM autoencoder. I read this article where the author suggests to train the model on clean data only in response to a comment. However, in most cases, it is not possible to find and exlude anomalies manually. I had always believed that because anomalies are very rare, if we train the model on all the data then the model will learn the normal behavior of time series and be ready to …
Category: Data Science

Getting a balanced sample across many variables

Let’s say each element in my population has several attributes. Let’s call then A, B, C, D, E, F. Let’s say, for simplicity, each attribute has 10 values (but could be any number between 2 and 30). Now I want to get a sample such that the distribution is the same across all features. So for example if the whole population has about 15% of people in feature A with value 1, my sample should be the same. What should …
Category: Data Science

Load textdomain from global languages directory

I am creating translations for my plugin. To fetch .mo files from my-plugin/languages directory , I use the function //Load translation function load_plugin_textdomain() { load_plugin_textdomain( 'my-plugin', FALSE, basename( dirname( __FILE__ ) ) . '/languages/' ); } add_action( 'plugins_loaded', 'load_plugin_textdomain' ); How can i set the location to wp-content/languages Setting the location to ABSPATH.'/wp-content/languages' doesn't work.
Category: Web

While training BERT variant, getting IndexError: index out of range in self

While training XLMRobertaForSequenceClassification: xlm_r_model(input_ids = X_train_batch_input_ids , attention_mask = X_train_batch_attention_mask , return_dict = False ) I faced following error: Traceback (most recent call last): File "<string>", line 3, in <module> File "/usr/local/lib/python3.7/dist-packages/torch/nn/modules/module.py", line 1102, in _call_impl return forward_call(*input, **kwargs) File "/usr/local/lib/python3.7/dist-packages/transformers/models/roberta/modeling_roberta.py", line 1218, in forward return_dict=return_dict, File "/usr/local/lib/python3.7/dist-packages/torch/nn/modules/module.py", line 1102, in _call_impl return forward_call(*input, **kwargs) File "/usr/local/lib/python3.7/dist-packages/transformers/models/roberta/modeling_roberta.py", line 849, in forward past_key_values_length=past_key_values_length, File "/usr/local/lib/python3.7/dist-packages/torch/nn/modules/module.py", line 1102, in _call_impl return forward_call(*input, **kwargs) File "/usr/local/lib/python3.7/dist-packages/transformers/models/roberta/modeling_roberta.py", line 132, in forward inputs_embeds = self.word_embeddings(input_ids) …
Category: Data Science

Splitting large multi class dataset using leave one out scheme into train and test

I am doing some supervised learning using neural networks, and i have a Targets array containing 1906 samples, which contain 664 unique values. min. count of each unique value==2, by design. Is there a smarter way to split this dataset into train and test, using a leaveoneout scheme to pick randomly 1 sample from each class and put it in the test set and use the rest for training, before i get down to explicitly iterating over all my values? …
Category: Data Science

Wordpress Pages Redirecting to Root with Wordpress Multisite (Sub-Directory)

I am working with Wordpress Multisite (with sub-directory structure). Everything works fine instead of Wordpress pages. When I publish a page and I try to visit it, it redirects to the main multisite. So for example, if the page is in this path: https://example.com/en-us/my-new-page/ it automatically redirects to: https://example.com/en-us/ Or another example, if the page is in this path: https://example.com/es-es/my-really-new-page/ it automatically redirects to: https://example.com/es-es/ I am using a plugin called Custom Permalinks to make posts URLs look nicer. I …
Category: Web

WP cron and update post meta

I try to create a scheduled cron job which runs every hour, Its my first time working with wp-cron. In the cron function, I want to update post meta values, if some conditions are met. I also tested the code of the cron function outside of the cron to see/print the results. The results looked ok, but when the cronjob runs no post gets updated. Iam using WP Crontrol to see the all available cronjobs. First I schedule an event …
Category: Web

Forecasting vs non-forecasting predition for time series anomaly detection

I have got the objective of implementing a uni/multivariate online anomaly detection system. After multiple days of research, I could collect many ways to achieve this (Eg. moving average solutions such as ARIMA, Space state solutions as Kalman filters, Holt-Winters double/triple exponential smoothing, CUSUM, one-class SVM, deep learning sliding-windows autoencoding approaches, deep learning using autoregressive neural networks, etc). In general, anomaly detection on time series works with a threshold on the deviation originated from the difference between a predicted point …
Category: Data Science

Need wp rest api for featured video post

hi i very new to rest api...I'm using WP REST API V2 in my project. After sending Get request to get posts, I don't see fields with the source of my audio/video wordpress posts (youtube or soundcloud sources) im trying use many api like wp-json/wp/v2/media /wp-json/wp/v2/posts?_embed wp-json/wp/v2/posts/?video_url i dont know how to fix this..pls anyone help me to fix this.. i can able to get only featured image for tat video post..could not able to play video..
Category: Web

XGBoost Log Loss different from GridSearchCV Log Loss

I have a classification problem where I am trying to predict if the data returns a 1 or 0. So your classic binary classification. I have my set of data that I have split into the dependent variables (ones I am training on) and the independent variable (my target that I am predicting, either a 0 or 1). I am using log loss as the scoring metric for my model. Firstly, I am using the cv function in xgboost to …
Category: Data Science

Need help with creating a searchable user data by name or specific number like ID

Thanks for this gift. Here is my issue, i wish to be able to add users profiles to my wordpress company site in which we register the users name and other details as need be. The purpose for this is that we safe files for customers and i want to register all user data accordingly then provide a search form where the users or myself can enter their name or a unique code or id which should display their complete …
Category: Web

under sample to get specific number of samples per class using tomek links of imblearn

I have a dataset with classes in my target column distributed like shown below. counts percents 6 1507 27.045944 3 1301 23.348887 5 661 11.862886 4 588 10.552764 7 564 10.122039 8 432 7.753051 1 416 7.465901 2 61 1.094760 9 38 0.681981 10 4 0.071788 I would like to under sample my data and include, only 588 samples for a class at maximum; so that the classess 6, 3 & 5 only have ~588 samples available after undersampling. Here's …
Category: Data Science

Duplicate Cron Jobs Using wp_next_scheduled / wp_schedule_event

I'm working on a plugin to register and schedule various cron jobs. I am: using WP Crontrol (just to see all of my cron jobs and override them if need be) have a server cron job set up and have define('DISABLE_WP_CRON', true); in place When I went into 'Cron Events' within Crontrol I saw that some functions were added literally hundreds of times. Specifically, in 'Cron Events' the function is what's getting registered/listed, not the hook. A simplified version of …
Category: Web

How to apply model to training data to identify mislabeled observations?

I have a list of people, attributes about those people (height, weight, blood pressure, etc.), and a binary target variable called has_heart_issues. This data represents the full population of data, and I am trying to determine whether anyone who is listed as "No" for has_heart_issues is similar to the people who are listed as "Yes". To answer this question, I split the data into training (70%) and testing (30%). I trained a random forest model on the training, and I …
Category: Data Science

Geometric Deep Learning - G-Smoothing operator on polynomials

(Note: My question resolves about a problem stated in the following lecture video: https://youtu.be/ERL17gbbSwo?t=413 Hi, I hope this is the right forum for these kind of questions. I'm currently following the lectures of geometric deep learning from (geometricdeeplearning.com) and find the topics fascinating. As I want to really dive in I wanted to also follow up on the questions they state towards the students. In particular my question revolves around creating invariant functions using the G-Smoothing operator (To enforce invariance, …
Category: Data Science

How to get my insert.php url in jquery?

I want to save my form data via jquery but i can't able to access it in my script.Can anyone help me. URL access in script: url: 'admin.php?page=insert.php', My script $(function () { $('form').on('submit', function (e) { e.preventDefault(); var schema_key = $("#schema_key").val(); $.ajax({ type: 'post', url: 'admin.php?page=insert.php', data: schema_key, success: function () { alert('form was submitted'); } }); }); });
Category: Web

About

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