wp_insert_post and title not utf8 inserts with empty title?

I'm using wp_insert_post I loop over a text file one row at a time and for each row I create a post. The text is set as the `post_title', for text that is not utf8 the post inserts but with an empty title. Why does that happen, if I'm able to create a post in the backend admin using non utf8 chars it looks like WordPress converts the encoding in the backend. How can I bypass this with wp_insert_post and …
Category: Web

Book recommendations for ML/DL Infrastructure Design

I'm looking for recommendations of books in the area of Infrastructure/SRE/DevOps but oriented to DL/ML. I know a few of them that seem to be too focused on production but what about training? How to design a cluster for deep models training? What about caching data for very large datasets? Is there such a thing? Or maybe a more general oriented book which principles can be applied easily to designing DL systems for training. Thanks in advance!
Category: Data Science

Aggregating multiple encoded categorical values

I am trying find commonly used techniques when dealing with high cardinality multi-valued categorical variables. I am currently using a dataset with a feature CATEGORY which has a cardinality of ~20,000. One-hot encoding does not make sense has it would increase the feature space by too much. Each observation in my dataset can take multiple values for the CATEGORY feature, for instance, row 1 could have the value a but row 2 could have the values a, b, c, d …
Category: Data Science

wpdb LIKE request shows all database data

I would like to get a list of user_nicenames and the ID. But not all the usernames which is what i'm getting now. I understand I should use the % before and after the $name only nothing seems to be working. This is the only way to get some output I found till now; global $wpdb; //get access to the WordPress database object variable //get names of all users $name = $wpdb->esc_like(stripslashes($_POST['name'])).'%'; //escape for use in LIKE statement $sql = …
Category: Web

Correct theoretical regularized objective function for XGB/LGBM (regression task)

I am writing an academic paper on the application of Machine Learning methods to Time Series Forecasting and I am unsure about how to write down the theoretical part about the regularized objective function for XGBoosting. Below you can find the equation given by the developers of the XGB algorithm for the regularized objective function (equation 2). The paper is called "XGBoost: A Scalable Tree Boosting System" by Chen & Guestrin (2016). In the Python API from the xgb library …
Category: Data Science

What can help decrease outliers' influence on non-tree models?

I have a feature with all the values between 0 and 1 except few outliers larger than 1. I am trying to collect all the methods that can help to decrease outliers' influence on non-tree models: StandardScaler Apply rank transform to the features Apply np.log1p(x) transform to the data MinMaxScaler Winsorization I wasn't able to imagine any other ... I guess that's all?
Category: Data Science

User list order by user meta

i have created user vote that can vote users or author of posts. so for example have 4 users which looks: user --- ID=1 --- META KEY='_thumbs_rating_up' --- META VALUE='13' user --- ID=2 --- META KEY='_thumbs_rating_up' --- META VALUE='17' user --- ID=3 --- META KEY='_thumbs_rating_up' --- META VALUE='8' user --- ID=4 --- META KEY='_thumbs_rating_up' --- META VALUE='241' So i must order these users by user meta key and meta value from heighest to lowwer. So i have these code now …
Category: Web

All-to-all modeling for structured dataset?

I have a structured dataset with rows as different samples and columns as different attributes of the samples. Interestingly, the attributes are highly inter-correlated (i.e. a complex system). I want to understand the system by training many classifier mdoels, with each model taking a column as the target and all the other columns as the features (which here I call such modeling "all-to-all"). Because the attributes and targets are highly correlated, many models should perform at reasonable accuracies. Before actually …
Category: Data Science

How do I get the trackback count of a post in wordpress without writing an SQL query?

How do I get the trackback count of a post in wordpress without writing an SQL query? I tried searching Brave Search and I couldn't find anything helpful. To fetch the amount of comments a post has, get_comments_number() is the wordpress protocol function for it. But what if I want to fetch the amount of trackbacks a post has? And also, do I have to be inside "the loop" to do this? What if I'm outside the loop?
Category: Web

Advantages of CNN vs. LSTM for sequence data like text or log-files

When do you tend to use CNN rather than LSTM (or the other way round) in classification or generation tasks of sequential data like text or log-data? What are the reasons for the decision and what does it depend on? Are there any papers or statistics that confirm this? I'm thinking of data like Linux log entries or short sentence of length of less than 20 words/tokens. Personally i would almost always use LSTM but I'm curious if CNN wouldn't …
Category: Data Science

Disable wordpress gif compression?

Is it possible to disable the default gif compression in Wordpress. I'm uploading animated gifs and they are turning soft. Any advice much appreciated. Attached is a screen grab illustrating the issue. lhs is the gif dragged into browser from the desktop, rhs is the gif as it appears on my website. thanks Nigel
Category: Web

Using large CNNs (e.g., ResNet) in convolutional autoencoders for image representation learning

I am confused about which CNNs are generally used inside autoencoder architectures for learning image representations. Is it more common to use a large existing network like ResNet or VGG, or do most people write their own smaller networks? What are the pros and cons of each? If people are using a large network like ResNet or VGG, does the decoder mirror the same steps taken by the encoder, or can a more simple decoding network be used? I am …
Category: Data Science

jQuery ajax method does not return data

I am sending email with phpmailer, I receive the emails when I press the "send" button, but I wanted to stay on the same HTML page, so I used AJAX script with HTML and PHP. The problem is that I am not getting the JSON data back that I need to update my HTML page with the email status and PHP reponse, so : response_array status response_array message response_array success Thank you for your help AJAX IN HTML <script> $("#form").submit(function(e) …
Category: Web

Interpreting confidence interval results for datasets

I have created a dataset automatically and wanted to clarify my interpretation of the amount of noise using the confidence interval. I selected a random sample and manually annotated the sample and found that 98% of the labels were correct. Based on these values I then calculated the confidence interval at 99% which gave a lower bound of 0.9614 and upper bound of 0.9949. Does this mean that the noise in the overall dataset is between the lower and upper …
Category: Data Science

Ajax 400 error when used inside a plugin

I'm really, really stuck. When I run this code I get a checkbox displayed. When I click the checkbox, the javascript is run. I get "test" in the console, followed by a 400 POST error. I can get this to work perfectly if I take it out of the plugin (and remove $this from the ajax actions), but I don't want to do that. Please can someone point me in the right direction! This is the code from my plugin …
Category: Web

Is file_get_contents() the only way for plugins reading local files OR does WP_Filesystem_Direct::get_contents() even work?

Background I'm developing a plugin for WordPress. I initially used file_get_contents() for two purposes: A remote file (which I changed to wp_remote_post()) A local file in the plugin dir (what this question is about) WordPress staff told me to NOT use file_get_contents() for remote _POST requests (usage 1. above), but to use wp_remost_post() instead. From their email concerning usage 1. (above): Using file_get_contents on remote files Many hosts block the use of file_get_contents on remote content. This is a security …
Category: Web

Woocommerce - Add additional item if some item wants to be added to the cart?

Is there a way for me to force the user to select one from a variety of products into the cart when they try to add a specific item to the cart? So lets say I have a Product like a blank USB and the customer chooses what product/software they would like loaded on the USB. I don't want to turn this in to a variable product as there could be hundreds of option. I don't want a customer to …
Category: Web

Timezone Settings: "UTC" and "local" times are incorrect

On the "General Settings" page of my WordPress site, it's not displaying the correct UTC and local times (see screenshot below). The displayed UTC and local times are wrong. It should say that local time is "15:52" I'm running WordPress 4.9.6 and PHP 7.0.30. The default timezone in my "php.ini" file is set correctly--when I call the date() and date_default_timezone_get() functions from a standalone PHP script, they output the correct information. The clock on my Windows web server is correct …
Category: Web

Using cross validation score to perform feature selection

So to perform my feature selection I ran cross validation over and over again, each time trying different subsets of my attributes and repeated this until I got the best cross validation score I could get. Is this alright to do or I am creating a major bias? I suspect that this could cause a bias and possibly result in data leakage because I am probably learning something about my test set by doing this, but how bad of a …
Category: Data Science

Importance/intuition behind stacking RNNs

Nowadays there's a trend towards using architectures of "deep" RNNs i.e. vertically stacked RNNs. RNN chapter from Bengio's bookThese networks seem to work well in practice. What's the intuition around using vertically stacked layers of RNNs (beyond the obvious fact that they increase the capacity by increasing the # parameters)?
Category: Data Science

Showing Subcategory's Name and Link Instead of Parent Category's

Right now my code is displaying the category name and link. But if an article is in a subcategory, I want to display the subcategory's name and link instead of the parent category's name and link. For some reason though it's still just showing the parent category. Any ideas what I'm doing wrong with the code? <?php $category_separator = ""; foreach((get_the_category()) as $childcat) { $parentcat = $childcat->category_parent; if( $parentcat != 0 ) echo '<span class="' . get_cat_name($parentcat) .'"><a href="' . …
Category: Web

Custom taxonomy throw error 404

So in my homework I was given code example and it works for teacher, but not for me. So from what i understand that I'm creating custom post type and custom taxonomy for it, also there is filter that replaces my %gaming_genre_new% with created category. And it works on custom post type stage, but it breaks when I add taxonomy. I can access for example my archive "gaming" and even created with taxonomy "genres" in it, but when i want …
Category: Web

Predicting next number in a sequence - data analysis

I am a machine learning newbie and I am working on a project where I'm given a sequence of integers all of which are in the range 0 to 70. My goal is to predict the next integer in the sequence given the previous 5 integers in the same sequence. There isn't much more information on the sequence of integers itself (for example, how was the sequence obtained, etc). The following are the things I tried. The first thing that …
Category: Data Science

Pagination links missing for first link (1) and previous button? How to get pagination links to work?

I'm trying to add pagination to my WordPress query using pagination_links() however I am getting no links returned for my page 1 links and previous link? Other links are adding the paged query string to the URL which then redirect you to /page/3/ for example. Unsure whether I need to update the query below to add these URL's instead of the query string? Can anyone see what is wrong with the below and how I can get the pagination links …
Category: Web

WGAN-GP: how to understand whether my networks are working as they are supposed to?

I am training a WGAN-GP. Is there any way to verify whether my networks are working as they are supposed to during training? I have no feeling about the outputs of my networks. I do not want to wait until the end of the training and then find out that there is something wrong. (I am using W Loss and MSE loss when training the generator. In a paper, I read authors saying that there is more information in the …
Category: Data Science

Validation loss and validation accuracy stay the same in NN model

I am trying to train a keras NN regression model for music emotion prediction from audio features. (I am a beginner in NN and I am doing this as study project.) I have 193 features for training/prediction and it should predict valence and arousal values. I have prepared a NN model with 5 layers: model = Sequential() model.add(Dense(100, activation='elu', input_dim=193)) model.add(Dense(200, activation='elu')) model.add(Dense(200, activation='elu')) model.add(Dense(100, activation='elu')) model.add(Dense( 2, activation='elu')) And this is my loss and optimizer metrics: model.compile( loss = …
Category: Data Science

Using if statement as a model in orange

I am seeking to evaluate logistic regression against a rule-based (nested if-else statements) classification in Orange. The steps I've taken to investigate this are as follows: I could not identify any widgets that would implement this. The closest I could find was the interactive tree from version 2.7, but this widget seems to have been discontinued. I've attempted to generate the results I'm looking for by editing the in_data object produced by creating a tree, sending the results to the …
Category: Data Science

Can classification model B trained on data labeled by classification model A exceed the performance of model A?

Let's say that I have a small or medium sized dataset of images, say 50,000. I use transfer learning to train a deep learning classification model. Call this model A. Model A is deemed to have good enough performance to be deployed. I deploy model A to a production environment where many users are able to consume the service by sending an image to an endpoint and receiving back the predicted class. Now lets say the service becomes very popular, …
Category: Data Science

What parameters to use when normalising training, validation, and testing data?

I know a similar post was made here, but I wanted to ask some follow up questions. I am conducting a cross-validation search to find values of a set of hyper-parameters and need to normalise the data. If we split up the data as follows: 'Training' (call this set 'A' for now) and testing data Split the 'training' into training (call this set 'B' for now) and validation sets what parameters should be used when normalising the datasets? Am I …
Category: Data Science

Trying to run a Ajax request from a checkout form in woocommerce via a custom plugin

I have a custom plugin with the following code add_action( 'init', 'my_script_enqueuer' ); function my_script_enqueuer() { wp_register_script( "gift_card_redeem", WP_PLUGIN_URL.'/plugin-folder/gift_card_redeem.js', array('jquery') ); wp_localize_script( 'gift_card_redeem', 'myAjax', array( 'ajaxurl' => admin_url( 'admin-ajax.php' ))); wp_enqueue_script( 'jquery' ); wp_enqueue_script( 'gift_card_redeem' ); } add_action("wp_ajax_gift_card_redeem", "gift_card_redeem"); function gift_card_redeem(){ if(!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest') { error_log("test !empty"); $result['type'] = "success"; $result = json_encode($result); echo $result; } else { error_log("test else"); header("Location: ".$_SERVER["HTTP_REFERER"]); } die(); } and a js file in the plugin called gift_card_redeem.js jQuery(document).ready(function () { jQuery(".redeem_gift_card").click(function …
Category: Web

how to apply segmentation on objects only

i have this image which is an output from my object detection model i wanted to apply segmentation on this image so that my mask will be like that i used grabcut algorithm but the results was too bad here's my code img=cv2.imread(testpath+imgname) mask=np.zeros(img.shape[:2],np.uint8) bgModel=np.zeros((1,65),np.float64) fgModel=np.zeros((1,65),np.float64) tmpimage=image masks=[] for i in recs: cv2.grabCut(img,mask,i,bgModel,fgModel,5,cv2.GC_INIT_WITH_RECT) mask2=np.where((mask==2)|(mask==0),0,255).astype('uint8') masks.append(mask2) #img=image*mask2[:,:,np.newaxis] finalmask=np.zeros(img.shape[:2],np.uint8) for i in range(len(masks)): finalmask=finalmask+masks[i] # for i in range(len(finalmask)): # for j in range(len(finalmask[i][:])): # for k in recs: # if i<k[0] …
Category: Data Science

WordPress Settings API, Implementing Tabs On Custom Menu Page

I've been following the WordPress Settings API tutorial series of this guy: http://wp.tutsplus.com/tutorials/theme-development/the-complete-guide-to-the-wordpress-settings-api-part-1/ So far, I've been successful at doing the basic thing. Now, when implementing tab, I'm facing problem. Problem 1: The Tabs are not working. All the fields are being displayed on both the tabs. Section 1, should be displayed on Tab One and Section 2 on Tab Two. Problem 2: Option 2 is not being saved. It was working fine before implementing tabs. Code: /* ----------------------------------------------------------------------------- */ …
Category: Web

Understanding SGD for Binary Cross-Entropy loss

I'm trying to describe mathematically how stochastic gradient descent could be used to minimize the binary cross entropy loss. The typical description of SGD is that I can find online is: $\theta = \theta - \eta *\nabla_{\theta}J(\theta,x^{(i)},y^{(i)})$ where $\theta$ is the parameter to optimize the objective function $J$ over, and x and y come from the training set. Specifically the $(i)$ indicates that it is the i-th observation from the training set. For binary cross entropy loss, I am using …
Category: Data Science

About

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