Get post from Category by Priority

I want get 3 posts from event custom post type. But i want to do that by category priority. If "featured" category has 3 upcoming event then i want to show 3 posts from it, if "featured" category doesn't have 3 upcoming events then i want to get posts from other category+posts without any category too. The end result will return 3 upcoming event. I'm a little confuse about how can i add that condition parameter on WP_Query. Current code(that …
Category: Web

What Equation is model.coef_ Derived From? (SKLearn)

Fairly simple question, but something I've been unable to understand firmly by scouring the interwebs. After running a LR model using SKlearn, one of the key outputs is coef_ , along with intercept_. I understand that coef_ is a transformation matrix that fully describes the relationships of the model; and that performing the dot-product of the input data, with coef_ and adding intercept_ will produce the predicted values for your inputs. My question is: What is the equation that defines …
Category: Data Science

Proper datashape and model architecture for recognizing highs and lows in a chart

I am using a Keras LSTM model to try to pinpoint the highs and lows (relative high points and low points) in a chart (I need the actual coordinates to those highs and lows, not just an image). The training process has no errors in it but the prediction output is completely irrelevant to the training output. what I've done so far is, I created the output data by feeding the input data to an algorithm from Scipy, argrelextrema. For …
Category: Data Science

How to specify version for dependencies so that each one is compatible and stays within a size limit?

I am trying to deploy a web app to Heroku. The free tier is limited to 500 MB. I am using my resnet34 model as a .pkl file. I create model with it using the fastai library. This project requires torch and torchvision as dependencies. But not specifying the dependency will download the latest version of torch which alone is 750 MB and exceeds the memory limit. So, I specify torchvision version as 0.2.2 and specify the wheel for torch …
Category: Data Science

Why is each successive tree in GBM fit on the negative gradient of the loss function?

Page 359 of Elements Of Statistical Learning 2nd edition says the below. Can someone explain the intuition & simplify it in layman terms? Questions What is the reason/intuition & math behind fitting each successive tree in GBM on the negative gradient of the loss function? Is it done to make GBM more generalization on unseen test dataset? If so how does fitting on negative gradient achieve this generalization on test data?
Category: Data Science

Use wp.media templates to create totally custom modal

Following up on this answer I'm trying to determine how to create a modal with completely unique menu items/content than the media modal. If you add a new state you can add a new menu tab and have it render the appropriate content when clicked. However, what I've found so far is that if you don't include the traditonal wp.media.controller.Library() states (for gallery, insert, etc) then the menu does not render at all and you are left with an empty …
Category: Web

RNN to model DNA sequencing classification

I have a DNA sequence dataset each mapped to a certain class. e,g TCAGCCGAGAGCTCATCGATCGTACGT 2 ATGCAGTGCATCGATCGATCGTAGAAC 3 Where the number after the sequence specifies the type of protein this sequence belongs to. So my question can I use KMers and 1-HOT-Coding to classify these sequences through biLSTM. Or this is not a possible concept and I would appreciate your feedback and suggestions on this task as I am new to Deep Learning. Thank you.
Category: Data Science

Show media-frame-menu on custom Media Frame

I have a plugin I built that adds a custom media frame with the following: media_frame = wp.media.frames.media_frame = wp.media({ title: 'Select your images', button: { text: 'Use Image' }, multiple: false }); media_frame.open(); This produces a media frame that looks like this: Thus far, this has been all I needed, but my site uses Wordpress Multisite and I'm trying to add in the Network Shared Media plugin. However, Network Shared Media requires the media-frame-menu sidebar in order to access …
Category: Web

Product CSV import problems with certain html tags

I'm transferring all of my WooCommerce products from one installation to another just by simply exporting the products to CSV and importing them again. Initially, the import would not work and the error message: Sorry, you are not allowed to upload this file type. This was a bit of a surprise as it was just an export csv file from another WooCommerce site. So I downloaded a sample csv import file and this worked fine. To cut a long story …
Category: Web

What is the Purpose of Feature Selection

I have a small medical dataset (200 samples) that contains only 6 cases of the condition I am trying to predict using machine learning. So far, the dataset is not proving useful for predicting the target variable and is resulting in models with 0% recall and precision, probably due to how small the dataset is. However, in order to learn from the dataset, I applied Feature Selection techniques to deduct what features are useful in predicting the target variable and …
Category: Data Science

Neural Network Stuck at Low Accuracy

I am new to deep learning so forgive me if this is an obvious mistake, I have tried to find similar questions online yet none seem relevant to my problem. I am using pytorch for image classification and my accuracy is stuck at ~40% even though my framework seems fine. Am I missing something major? My data has 5 columns: Age, Gender, Ethnicity, Image name , and "pixel" values (which are already scaled). I want to target the "ethnicity" output, …
Category: Data Science

Why is matplotlib not plotting some boxplots?

I am trying to plot some data so get statistics about it, but matplotlib simply can't plot it as boxplots. I tried with histograms and it workd well: But when i change the code to plot boxplots it just doesnt work: I know that the y axis is in the wrong place, but I even searched on where it should be (for example SAQRS in the range of -150 to 50) but even there there is nothing. The plotting code …
Topic: matplotlib
Category: Data Science

Mass remove a number of tags from a number of posts

i am having a wallpapers site. I was having lots of posts with no tags and i tried some plugins to auto add tags like simple tags where you need to set some tags and it will auto use those tags for posts, then i used auto tag posts option and it added all the 50-60 tags to a number of individual posts,Means it added 50-60 tags to each of the posts in 500 posts. Its very time consuming now …
Topic: tags Wordpress
Category: Web

Using softmax for multilabel classification (as per Facebook paper)

I came across this paper by some Facebook researchers where they found that using a softmax and CE loss function during training led to improved results over sigmoid + BCE. They do this by changing the one-hot label vector such that each '1' is divided by the number of labels for the given image (e.g. from [0, 1, 1, 0] to [0, 0.5, 0.5, 0]). However, they do not mention how this could then be used in the inference stage, …
Category: Data Science

Error on custom RNN/LSTM with multiple inputs

I want to implement a custom RNN/LSTM model similar to this. The model should take two separate vectors as input and process them. I was following keras tutorial to implement a custom keras layer and inputting two vectors a and b as a list [a,b] to the layer as shown below. import keras from keras.layers.recurrent import RNN import keras.backend as K class MinimalRNNCell(keras.layers.Layer): def __init__(self, units, **kwargs): self.units = units self.state_size = units super(MinimalRNNCell, self).__init__(**kwargs) def build(self, input_shape): print(type(input_shape)) self.kernel …
Category: Data Science

A problem with functions.php file on my WordPress site

When I add functions.php file to my WordPress website, my website just stops working. It doesn't matter if I have or have not code there, whenever the functions.php file is present, the site stops working. I tried to check if there is any typo or parser error, but I can't find nothing nor the debugger doesn't report anything. This happens also when I follow tutorial in a book.
Category: Web

Determining increments for aggregated time series data to determine impact of individual features

I'm working with a data source that provides itemised transactions, which I am aggregating into 1 hour blocks to determine a 'rate per hour' as the dependent or target variable - i.e. like a time series. So far I've looked at Logistic Regression, Random Forest Regressor and Gradient Boosting Regressor and got reasonable results - but am really trying to determine the weighting/ impact of the independent variables, to see which have the biggest impact on the DV. Would there …
Category: Data Science

Interpreting cluster variables - raw vs scaled

I already referred these posts here and here. I also posted here but since there is no response, am posting here. Currently, I am working on customer segmentation using their purchase data. So, my data has below info for each customer Based on the above linked posts I see that for clustering, we have to scale the variables if they are in different units etc. But if I scale/normalize all of them to uniform scale, wouldn't I lose the information …
Category: Data Science

How to use sodium percarbonate

I have read that when mixed in water, sodium percarbonate gradually dissolves, leaving behind only water. However, I have recently come across this video which says that pre-used sodium percarbonate solution remains effective and can be used to clean/sanitise more equipment, as long as two days after initial use. Does sodium percarbonate really leave behind only water, or is there something else left in the water that means it can be re-used, as suggested in the linked video? When using …
Category: Mac

Archive product loop does not work with product filters

I managed to change product loop to my needs, showing taxonomy and taxonomy desription to products. I would like to have the same result when I click to product categories or tags or brands in product filters. Instead nothing happens and it returns the basic loop I changed. In other words I want to show the products in this format category category desc products and keep this format when I use the product filters my website is https://gracious-newton.138-201-58-116.plesk.page/shop/
Category: Web

display dynamic WP Site logo on wp-admin using CSS

I'm looking for a way to always display the current site logo (as set in customiser) on the wp-admin page in place of the WP logo via CSS. I know how to manually add a custom image (code below is part of the function I use): #login h1 a, .login h1 a { background-image: url(<?php echo get_stylesheet_directory_uri(); ?>/images/logo.png); background-size: contain; But I would like to make the entire URL dynamic, so the site logo can be changed in the customiser …
Category: Web

Log odds vs Log probability

Log-odds has a linear relationship with the independent variables, which is why log-odds equals a linear equation. What about log of probability? How is it related to the independent variables? Is there a way to check the relationship?
Category: Data Science

How to use query parameters, as "_fields", to filter data inside an array in the REST API?

How to handle this endpoint /wp-json/wc/v3/products/?_fields=name,meta_data [ { "name": "Test", "meta_data": [ { "id": 478626, "key": "_wp_page_template", "value": "default" }, to achieve this? [ { "name": "Test", "meta_data": [ { "value": "default" }, I took a look at the documentation, but I didn't find anything relevant. Since meta_data is an array, this syntax DOESN'T work: /wp-json/wc/v3/products/?_fields=name,meta_data.value
Category: Web

Model Parallelism not working in Inception v3 with Keras and TensorFlow

I have been stuck with a problem like this for a while now. I have an AWS setup with 500 GB of RAM and about 7 GPUs. Now the issue is that each time I try to run my Keras with TensorFlow as back-end code, it runs out of memory. I have found out the reason for this as well. The reason is that each GPU just has 12GB of memory, whereas my model needs more than that. So, how …
Category: Data Science

Stripping unicode characters out of slug

I am trying to strip the following characters out of slugs: ṁ, ṭ, ḍ, ṇ, ṅ, ñ, ḷ, ṃ. I found this code here (note: I have removed public in order to get it to work) add_action('wp_insert_post_data', __NAMESPACE__ . 'processPermalink'); /** * Processes the permalink so we can remove any characters that may cause a problem when communicating * with the API. * * @param array $data The array of information about the post. * @return array $data The data …
Topic: slug Wordpress
Category: Web

7Zip bulk gzip creation for SQL DB Parts

I have this folder here that contains the multiple sql files and I want to convert them to Gzip using 7Zip. You can only see 10 files but there are 254 files since it is a large database. I tried the following command for /f %%X in (*.sql) do "c:\Program Files\7-Zip\7z.exe" a -tgzip "%%X.zip" "%%X" but command prompt says "The system cannot find the file *.sql." Even the command with no extension such as (*.) says the same thing that …
Category: Web

How to set all external links to a certain domain to "nofollow"?

I am searching for a code or better a wordpress plugin to set automatically all links only to a certain domain (and of course to all of its subpages) to "nofollow". I could not find any plugin which is doing that, maybe you are knowing one or a coding-solution (javascript I guess). F.e. the plugins I found and their problems: https://wordpress.org/plugins/nofollow/ Has only "A nofollow option for individual blogroll links" -> so no possibility to set only a certain domain …
Category: Web

How to use thumbnail size of image if I'm only using src to get image

I have a custom field for an image, and using it this way: <?php $item_img = get_sub_field('image'); ?> <img src="<?php echo $item_img ?>" /> But I want to use the thumbnail version of the image, as set to 150x150 in wordpress. How do I do that with this type of setup? Do I have to set a custom add_image_size() or does wordpress have duplicated thumbmail size images?
Category: Web

How to integrate google cloud with dropbox and jupyter notebook using tensorflow

So I opened up a google cloud account and have access to global and local (us east 1) resources (Compute Engine API , NVIDIA K80 GPUs) and connected it to my dropbox. Next, I followed this youtube video to try to connect it to my jupyter notebook. The code to be entered into the google cloud platform is as follows: sudo apt-get update sudo apt-get - -assume-yes upgrade sudo apt-get - -assume-yes install software-properties-common sudo apt-get install python-setuptools python-dev build-essentials …
Category: Data Science

Deep Learning in a Camera

I don't know if this is the right place to ask this. Is it possible to run deep learning inside a camera and if so, how? I want to be able to take a picture and then use deep learning techniques to do image recognition by using it against hundreds or thousands or millions of other images. Is the only way to do this by taking a picture, sending it to a cloud or something like that and then input …
Category: Data Science

Ignoring features in XGBoost by setting them as "missing"

I have some data n x m and I want to ignore certain features. One idea I had is to mark those features as "missing", since XGBoost can handle missing values by default, e.g. using nan when constructing the DMatrix: n, m = 100, 10 X = np.random.uniform(size=(n, m)) y = (np.sum(X, axis=1) >= 0.5 * m).astype(int) # ignore certain features: mark them as missing X[:, 2:7] = np.nan dtrain = xgb.DMatrix(X, label=y, missing=np.nan) model = xgb.train(params={'objective': 'binary:logistic'}, dtrain=dtrain) My …
Category: Data Science

Feature construction widget on Orange 3.13

I am working with Orange for my thesis with logs and core data; however, since I am a beginner, I am a little bit stuck with the feature construction widget. Ultimately, I would like to combine different features to compare them. What kind of information should I put in "Values" field with a categorical feature? If you have any examples on this it would be really appreciated (the ones from Orange did not help me).
Category: Data Science

About

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