list taxonomy terms in current post / current category

i need to display taxonomy terms in a custom post and also in archive / category page of that post type. terms must be from current post or current category https://stackoverflow.com/questions/15502811/display-current-post-custom-taxonomy-in-wordpress code in this thread works for only single post, can i make it work in archive / category page too pls.
Category: Web

Consequences of using XGBoost regressor for small dataset(< 500 rows)

I am using XGBoost regressor to train my model for 322 rows of data and the train and test split is as follows: ((257, 9), (257,), (65, 9), (65,)) I am using the following parameters for hyper-parameter tuning: {'max_depth': 3, 'min_child_weight': 6, 'eta': 0.3, 'subsample': 0.9, 'colsample_bytree': 0.7, 'objective': 'reg:linear', 'eval_metric': 'rmse', 'reg_lambda': 0, 'reg_alpha': 0.5, 'gamma': 0} I am getting the following results: Train results: MAE = 43.95317769328908 RMSE = 69.32233101307436 R2 score = 0.7500463354991436 -------------------------------------------- Test results : …
Category: Data Science

How to access wordpress menu & submenu item through the REST API?

I want to display the menu &amp; submenu items from Wordpress in another web-application, menu and Submenu are get but there is more menu inside Submenu I want that. function return_menus( $data ) { $menuID = $data['id']; //$primaryNav = wp_get_nav_menu_items($menuID); $x = wp_get_nav_menu_items($menuID); // echo '&lt;pre&gt;'; // print_r($x); // echo '&lt;/pre&gt;'; $menu = array(); $submenu = array(); foreach($x as $y){ $y-&gt; submenu = array(); if($y-&gt;menu_item_parent === '0') array_push($menu, $y); else array_push($submenu, $y); } for($i=0; $i &lt; count($submenu); $i++) { $index …
Category: Web

Confidence intervals in multivariate linear regression

I am fitting my data to a multivariate linear regression $Y = BX + \Xi$, where the response is bivariate $Y\in R^{n\times 2}$, and the predictor is uni-variate but elevated to the projective plane to account for the intercept $X\in R^{n\times 2}$. Now, finding the best fit reduces to $\hat B = (X^T X)^{-1}X^T Y$. But I am interested in finding a $0.7$ confidence region around $\hat B$. How do I do that?
Category: Data Science

How to build Non Linear Vector auto regression using Neural Nets

I have worked on VAR ( vector Auto regression), which forecasts multiple output values(continuous) when there is linear relationship between all variables. I want to use Neural nets to do so,sothat I can include non linear relation among variables also. Is there any specific type of NN available? If not how can I implement it using NN?
Category: Data Science

Create Dynamic SEO Friendly URL for Virtual Page

I have a Wordpress site that is built to be a job listing board, and I'm looking to create SEO friendly URLs based on data that is stored in the database. The URL structure should include the state abbreviation, city, and job title, and result in the following format: www.domain.com/job/ca/sacramento/janitor There is currently a &quot;Job&quot; page in the backend that uses custom page template located at 'page-templages/job-template.php' that displays the database information at the following URL: www.domain.com/job/?2020-412341235134 How can I …
Category: Web

Create new posts in bulk using existing post

After using short codes and reusable blocks, I have created a post which is created dynamically only on the bases of the title of the post. That post looks like this: I want to create 100's of such posts with different post titles like 1) atdhe.net 2) gua.com I can use the duplicate post plugin but it doesn't create posts in bulk. My requirement is that the solution should take a list of titles from me as input and then …
Category: Web

Linear regression doesn't return the expected number of $\beta_i$

I have a dataset of precincts and results of parties on different elections. After reading this article I really wanted to use linear regression to answer the question : how did voters changed their mind since last elections ? Unnamed: 0 Map Level Precinct ID Precinct Name Election Invalid Ballots (%) More Ballots Than Votes (#) More Votes Than Ballots (#) Total Voter Turnout (#) Total Voter Turnout (%) ... Average votes per minute (17:00-20:00) CDM ED FG GD LP …
Category: Data Science

How to filter get_post with ACF by a checkbox field?

So, I have a custom content type called "team" where I have an ACF field attached called "external" which is a checkbox. I am currently getting all the posts by passing the following arguments array to the get_post function. $args = array( 'posts_per_page' =&gt; -1, 'offset' =&gt; 0, 'orderby' =&gt; 'menu_order', 'order' =&gt; 'ASC', 'post_type' =&gt; 'team', 'post_status' =&gt; 'publish', ); What I'd like to do is run this in two functions checking if the field is or is not …
Category: Web

Is this Double U-Net overfitting?

I'm working on a undergraduate project with using deep learning. Currently, I'm trying to improve a model by modifying it. Model is Double U-Net and dataset that I'm using is DRIVE dataset. It consists from 20 images. My problem is validation score does not increase anymore. I think there is a overfit problem and also, I heard that is the max potential of network so I should try another dataset or model. Data separated 80% training and %10 validation. How …
Category: Data Science

Pagination for user list

I am showing all the users by using the get_user() function. But I need to paginate the results. I tried a lot, but didn't succeed. Here is the code, which doesn't work as expected: $args = array( 'meta_query' =&gt; array( array( 'key' =&gt; 'ib_s2member_custom_fields', 'value' =&gt; trim($_GET["country"]), 'compare' =&gt; 'LIKE' ), array( 'key' =&gt; 'ib_s2member_custom_fields', 'value' =&gt; trim($_GET["city"]), 'compare' =&gt; 'LIKE' ), array( 'key' =&gt; 'ib_s2member_custom_fields', 'value' =&gt; $first_name, 'compare' =&gt; 'LIKE' ), array( 'key' =&gt; 'ib_s2member_custom_fields', 'value' =&gt; $last_name, …
Category: Web

When can it be called transfer learning?

A common definition of transfer learning is: &quot;Transfer learning is the improvement of learning in a new task through the transfer of knowledge from a related task that has already been learned.&quot; — Chapter 11: Transfer Learning, Handbook of Research on Machine Learning Applications, 2009. This raises the question, when a task can be termed &quot;related&quot;. Let's assume a neural networks is trained to estimate house prices for american houses. Could it be called transfer learning, if I retrain/finetune the …
Category: Data Science

Add wrapper to only youtube videos via embed_oembed_html filter function

I have a filter working to wrap embed_oembed links in a responsive wrapper. See code. add_filter('embed_oembed_html', 'wrap_embed_with_div', 10, 3); function wrap_embed_with_div($html, $url, $attr) { return '&lt;div class="responsive-container"&gt;'.$html.'&lt;/div&gt;'; } The only problem is this also applies to everything else on the oembed list, i.e, twitter embeds, instagram, etc. I was trying to add an if statement, but have no luck. Basically, it would be great to just add this wrapper to video embeds like youtube/vimeo. Here is what I got so …
Category: Web

Training a model that has both 2D and 1D features using a CNN

I'm looking to pre-train a model for an RL agent but I'm having some trouble figuring some stuff out. Dataset: Minerl MineRLNavigateDense-v0 The observation space includes : 2D screen input (64,64) (+ 3 channels of color) 1D (scalar) compass angle 1D (scalar) number of dirt blocks + this is all over time. I am also given the reward based on the action the human took. When training a model using a CNN for time series classification my understanding is that …
Category: Data Science

Sort by an ACF field in a tax_query

I do not find the solution which must surely be surely simple. (I'm new to WP) I have an ACF field named "partners_order". I would like to sort it in ascending order (ASC) here's what i tried &lt;?php $terms = get_terms('type_partenaires'); usort($terms, function($a, $b) { return get_field('ordre_affichage', $a) - get_field('ordre_affichage', $b); }); foreach ( $terms as $term ): ?&gt; &lt;?php echo $term-&gt;name; ?&gt; &lt;?php $loop = new WP_Query( array( 'post_type' =&gt; 'partenaires', 'orderby' =&gt; 'title', 'order' =&gt; 'ASC', 'posts_per_page' =&gt; …
Category: Web

How can I overlay a contour map over a picture of a country?

So for context, I have a massive dataset of over 2.7 million rows of average download/upload speeds of individuals in Canada, with province/city columns. I would like to plot a contour map of average down/up speed over a picture of the country Canada, kind of like this: https://www.floodmap.net/Elevation/ElevationMap/CountryMaps/?cz=US_1 But unfortunately I have no clue on how to make something like that. I would really appreciate it if someone could point me to the right direction.
Category: Data Science

How to use keras.utils.Sequence with multiple files

I am looking at the documentation and this guide https://www.tensorflow.org/api_docs/python/tf/keras/utils/Sequence https://stanford.edu/~shervine/blog/keras-how-to-generate-data-on-the-fly And I need to write in def __len__(self): and def __getitem__(self, idx): Which gets the length of the dataset, and the getting a data sample using a particular index. So I am wondering if this is appropriate to use for multiple files, and if so, are there any best practices for this?
Category: Data Science

New multisite redirects to main site

I have created a new multisite and for some reason certain links redirect to the main site. For example if you go to http://team-isagenix.isagenixhealth.net and click on the October 2014 link under Archives. It will then redirect you to the main site (isagenixhealth.net) and I do not want this to happen. Do I need to make further changes in the htaccess file? Here is the code I have there right now: (Also please not I have other multisites on this …
Category: Web

get all products of one category

i use this function to get all products of one category in ajax request function get_products() { $cat_id = $_POST['category']; $args = array( 'post_type' =&gt; 'product', 'post_status' =&gt; 'publish', 'ignore_sticky_posts' =&gt; 1, 'posts_per_page' =&gt; '12', 'tax_query' =&gt; array( array( 'taxonomy' =&gt; 'product_cat', 'field' =&gt; 'term_id', //This is optional, as it defaults to 'term_id' 'terms' =&gt; $cat_id, 'operator' =&gt; 'IN' // Possible values are 'IN', 'NOT IN', 'AND'. ), array( 'taxonomy' =&gt; 'product_visibility', 'field' =&gt; 'slug', 'terms' =&gt; 'exclude-from-catalog', // Possibly …
Category: Web

WPBakery Page Builder Shortcode Showing On Front Page For Post

I am working on a new site and am having an issue with the WPBakery plugin. I assume its a custom version of WPBakery, since it's marked WPBakery Page Builder by VisualModo, which is who my theme is through. The problem I am having is tat on the front page, which is static, I have a section to show Blog items and they do show up, along with the short codes that are rendered correctly on that actual post. I …
Category: Web

Random Forest significantly outperforms neural net for my regression task. What insight can I extract from this?

I'm working on a regression problem for a personal project, and I've noticed that random forest performs significantly better than the current neural net architectures I'm using. (about 0.7 R2 for a fairly deep RF on test-data vs 0.2-3 R2 for 2 hidden layer NN on even the training data). Does this mean that my problem needs a deeper, more complex model? more importantly, since according to my understanding RF uses a random combination of features at every decision node, …
Category: Data Science

how to add cross term in logistic regression model?

I have a data of 2000 (say locations of different fruits grow) and 10000 (say factors responsile for growth of fruits). And I also know that there are 20 different types of fruits in these locations. I want to built a logistic model for this dataset such that if I get a new location then my model should be able to define the type of fruit. log_reg_model = LogisticRegression(max_iter=500,penalty='l2',solver='newton-cg') log_reg_model.fit(neighborhoodClass,target) The shape of neighborhoodClass is (2000, 10000) and the target …
Category: Data Science

How to change the canonical link from a category or taxonomy archive?

On this url: https://www.phuket-luxury-villas.us.com/tourist-spots/buddhist-temples-wats/ I have a wrong canonical link: &lt;link rel="canonical" href="https://www.phuket-luxury-villas.us.com/tourist-spots/buddhist-temples-wats/" /&gt; It used to be the follow canonical link: &lt;link rel="canonical" href="https://www.luxuryvillasphuketthailand.com/tourist-spots/buddhist-temples-wats/" /&gt; I tried to use this code: function yoast_seo_canonical_change_woocom_shop( $canonical ) { if ( is_archive() ) { echo ''; } } add_filter( 'wpseo_canonical', 'yoast_seo_canonical_change_woocom_shop', 10, 1 ); But it seems that is put now too many canonical links on the website... Any idea what else I can do? This mentioned url, is an archive (done …
Category: Web

How can I detect partially obscured objects using Python?

I'm building a computer vision application using Python (OpenCV, keras-retinanet, tensorflow) which requires detecting an object and then counting how many objects are behind that front object. So, objects are often overlapping. For example: How many are in this queue? Here, the aim is to detect the person in the front (foreground) of the queue, and then detect the amount of people behind the front person, despite those behind being obscured. I have built an object recognition model using keras-retinanet …
Category: Data Science

When is the sum of models the model of the sum?

The response variable in a regression problem, $Y$, is modeled using a data matrix $X$. In notation, this means: $Y$ ~ $X$ However, $Y$ can be separated out into different components that can be modeled independently. $$Y = Y_1 + Y_2 + Y_3$$ Under what conditions would $M$, the overall prediction, have better or worse performance than $M_1 + M_2 + M_3$, a sum of individual models? To provide more background, the model used is a GBM. I was surprised …
Category: Data Science

Change locale by detecting viewer's browser language setting and let them choose prefered language after

I am coming from a multi-linguo country, and viewers may speak different language. I am writing a theme and I noticed that the language of my theme only changed based on the setting of my admin panel, which mean only logged-in user or admin can do so. What if I wanted to do it automatically by detecting user browser preference? I am using Jquery to achieve some of this function but thinking it not the right way. What I was …
Category: Web

How to perform tokenization for tweets in xlnet?

X_train has only one column that contains all tweets. xlnet_model = 'xlnet-large-cased' xlnet_tokenizer = XLNetTokenizer.from_pretrained(xlnet_model) def get_inputs(tweets, tokenizer, max_len=120): &quot;&quot;&quot; Gets tensors from text using the tokenizer provided&quot;&quot;&quot; inps = [tokenizer.encode_plus(t, max_length=max_len, pad_to_max_length=True, add_special_tokens=True) for t in tweets] inp_tok = np.array([a['input_ids'] for a in inps]) ids = np.array([a['attention_mask'] for a in inps]) segments = np.array([a['token_type_ids'] for a in inps]) return inp_tok, ids, segments inp_tok, ids, segments = get_inputs(X_train, xlnet_tokenizer) AttributeError: 'NoneType' object has no attribute 'encode_plus'
Category: Data Science

Htaccess file reset automatically how to fix this issue

Often my WordPress htaccess file was reset am not able to find the root cause of this issue. But I guess this may happen when installing any plugin or manually take a complete backup of the site. Also, I have checked htaccess file permission as well. Please let me know how to fix this issue soon. Thanks in advance.
Category: Web

Why grad cam is not showing despite of no error?

I am applying grad-cam on 3d images and I see no errors, I only can see the Scan of my original images but not the grad cam. from skimage.transform import resize from matplotlib import pyplot as plt capi=resize(cam,(79,95,79)) #print(capi.shape) capi = np.maximum(capi,0) heatmap = (capi - capi.min()) / (capi.max() - capi.min()) f, axarr = plt.subplots(2,3,figsize=(15,10)); f.suptitle('Grad-CAM') slice_count=78 slice_count2=20 axial_ct_img=np.squeeze(resized_img[slice_count, :,:]) axial_grad_cmap_img=np.squeeze(heatmap[slice_count,:, :]) coronal_ct_img=np.squeeze(resized_img[:,slice_count2,:]) coronal_grad_cmap_img=np.squeeze(heatmap[:,slice_count2,:]) img_plot = axarr[0,0].imshow(axial_ct_img, cmap='gray'); axarr[0,0].axis('off') axarr[0,0].set_title('CT') img_plot = axarr[0,1].imshow(axial_grad_cmap_img, cmap='jet'); axarr[0,1].axis('off') axarr[0,1].set_title('Grad-CAM') axial_overlay=cv2.addWeighted(axial_ct_img,0.5,axial_grad_cmap_img, 0.5,0, dtype = …
Category: Data Science

Are genetic algorithms considered to be generative models?

My understanding is that these sorts of algorithms can evolve/mutate data to hone in on specific desirable areas in large/difficult to search parameter spaces. Assuming one does this successfully, how does one generate new data/sample from that desirable range? Does doing so utilize the same algorithm/structure, or would additional methods need to be introduced? If genetic algorithms improve the efficiency of a search by finding promising regions, can they be considered as a type of generative models? Or would that …
Category: Data Science

PHP warning - Use of undefined constant ‘FORCE_SSL_LOGIN’ ‘FORCE_SSL_ADMIN’ on wp-config.php

I have a bothering PHP warning for ages, and I am wondering if someone has solution to this. The following two-line warning is constantly recording in my error_log file: PHP Warning: Use of undefined constant ‘FORCE_SSL_LOGIN’ - assumed '‘FORCE_SSL_LOGIN’' (this will throw an Error in a future version of PHP) in /home/myuser/public_html/wp-config.php on line 92 PHP Warning: Use of undefined constant ‘FORCE_SSL_ADMIN’ - assumed '‘FORCE_SSL_ADMIN’' (this will throw an Error in a future version of PHP) in /home/myuser/public_html/wp-config.php on line …
Category: Web

Supervised learning on sources of information with different importance

I am trying to classify customer support sessions using supervised machine learning. In each customer support session I have 3 bags of information. 1. The title of the customer's complaint 2. Information about the device the customer was using 3. Text of the chat session with the customer support agent In each customer support session, there are 6 different classes. Is it better to: 1. Train a classifier on each bag of information and have them vote on which class …
Category: Data Science

How can i redirect one url to another url using .htaccess or add_rewrite_rule

I am stuck at redirecting one url to another url. I want to redirect https://samedomain.com/page-check-927GSJAYS639AL/highlights to https://samedomain.com/page-highlights/ (927GSJAYS639AL this is id it can be anything) the http://samedomain.com/page-highlights/ is the wordpress page The rewrite rule I tied in .htaccess file (added this in the first line it-self) is: RewriteEngine On RewriteRule ^page-check-([A-Z0-9_-]+)/highlights$ page-highlights?id=$1 [L] but I see a 404 error page It worked for RewriteEngine On RewriteRule ^page-check-([A-Z0-9_-]+)/highlights$ info.php?id=$1 [L] I also tried WP rewrite API php code UPDATE 1 add_action('init', …
Category: Web

How to use text classification where the training source are txt files in categorized folders?

I have 200 *.txt unique files for each folder: Each file is a lawsuit initial text separated by legal areas (folders) of public advocacy. I would like to create training data to predict new lawsuits by their legal area. Last year, I have tried using PHP-ML, but it consumes too much memory, so I would like to migrate to Python. I started the code, loading each text file in a json-alike structure, but I don't know the next steps: import …
Category: Data Science

How do you avoid caching during development?

Is there a simple way to prevent all caching when testing the appearance of changes to the site? I use WP Super Cache. I can delete its cache using the option provided, delete the cache for my browser, and still some changes to CSS or widgets do not refresh. I try other work-arounds like switching browsers or computers, but there must be a more stream-lined workflow where I can ensure I'm viewing the changes I made and not some cached …
Category: Web

About

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