Unique icons next to each Wordpress menu item

I have Wordpress menus that is seems are put together in the backend somehow. I used wp_nav_menu() to customize the wrap of the menu items slightly. My issue is I have found no direct access to access the menu items, and add a custom field to them. They are all categories, and I want a specific icon for each category. This is my code in the functions.php to customize the menu: function custom_novice_menu($args) { $args['container'] = false; $args['container_id'] = 'my_primary_menu'; …
Category: Web

A dataset made up of 3D objects added to real footage with the masks of the 3D objects

I am looking for a way to test the performance of an object removal program I am looking for a dataset (images or videos) that is made up of realistic 3D objects added to real footage. There must be a version before the object was added as well as after the object was added, so I can compare the results. Also, I would need the true mask of the object that has been added.
Topic: dataset
Category: Data Science

lookup and fill some value from one dataframe to another

I have 2 dataframes, df1,and df2 as below. df1 and df2 I would like to lookup "result" from df1 and fill into df2 by "Mode" as below format. Note "Mode" has become my column names and the results have been filled into corresponding columns. also note that "ID" from df2 may not necessary equal to "ID" from df1.For example, I am only interested in 4 IDs (A01,A03,A04 and A05, no A02) while df1 may contain more IDs I tried to …
Category: Data Science

Eigenvectors of points on a straight line PCA1 and PCA2

let immagine that I have 3 points and they are all on a sloped straigh line such as (-4, -2) (0,0) (2,1) this is straight line passing from the origin. Intuitevely pca2 would be 0 as I have not up spread in the data. And PCA1 would be the max variance of the data on the line. Is my intuition correct for pca2 = 0? is there any intuitive way to calculate PCA1 for this case scenario?
Topic: pca
Category: Data Science

Percentile as a threshold for Anomaly Detection?

I'm following this article about Unsupervised Anomaly Detection Algorithms. In this article, a threshold value is calculated using the scipy score percentile method to determine whether the point is an outlier or not. What is the connection between percentile value and threshold and how can we decide if a point is an outlier or not using a threshold value?
Category: Data Science

Can't access 2nd site (sub) dashboard of Wordpress Multisite

I can't access the dashboard of the second site. When I go to the second site, I only see the HTML page without the style (css). When I try to access the dashboard (from Safari), I get this message from the browser: "too many redirects occurred trying to open". Subsite set-up example.com (works) example.com/secondary (doesn't work) I tried disabling all plugins and change to the default theme. It still doesn't work. Here's what in my .htaccess file: # BEGIN WordPress …
Category: Web

Custom post type category link redirecting to 404 page

I have created a custom post type. There is no issue with post and it's working. I am getting issue in the catgory links. When i click on the Category name it's redirecting on 404 page I am getting category link like https://example.co/blog/categoryname/ I have tried to reset the peramlink but still getting issues. function create_blog_cpt() { $labels = array( 'name' => _x( 'blogs', 'Post Type General Name', 'blogsdomain' ), 'singular_name' => _x( 'blog', 'Post Type Singular Name', 'blogsdomain' ), …
Category: Web

WooCommerce , Auto cancel orders status from processing after X days

Trying to use this code in function.php, but not working.. Any idea whats wrong? // To change the amount of days just change '-7 days' to your liking function get_unpaid_submitted() { global $wpdb; $unpaid_submitted = $wpdb->get_col( $wpdb->prepare( " SELECT posts.ID FROM {$wpdb->posts} AS posts WHERE posts.post_status = 'wc-processing' AND posts.post_date < %s ", date( 'Y-m-d H:i:s', strtotime('-14 days') ) ) ); return $unpaid_submitted; } // This excludes check payment type. function wc_cancel_unpaid_submitted() { $unpaid_submit = get_unpaid_submitted(); if ( $unpaid_submit ) …
Category: Web

Generalization of accuracy score based on subset of data points

I have a multi-class problem that I am building a classifier for. I have N total data points I would like to predict on. If I instead predict on n < N data points and get an accuracy score, is there a way I can say (with some degree of confidence) what I think the same model's accuracy score would be on the remaining data points? Can somebody point me to an article discussing this, or suggest a formula to …
Category: Data Science

Why (or how) does a Keras model skip Stemming or Lemmatization steps?

This Keras article / tutorial here does perform text standardization i.e removing HTML elements, punctuation, etc. from the text dataset, however, there is a distinct lack of any stemming or lemmatization before the vectorization step. I have a bit of experience in deep learning but I am very new to NLP, and I just got to know (from a different tutorial on Udemy, which BTW was using Bag of Words) that using either a Stemmer or a Lemmatizer helps in …
Category: Data Science

Model for classifying time-series data with distinct features?

I've heard about time-series classification being done with TCN's and CNN's combined with LSTM's very often, citing that CNN's would provide insight both forward and in the past since you already have all the information for that time period. For my application, there is a distinct shape and I'd like to classify whether it exists or not. For example, I want to detect whether the data looks like this or this Of course, there would be noise involved and the …
Category: Data Science

sentence type classification

I want to classify the sentences in my dataset as declarative, interrogative, imperative and exclamative. Although It can be classified with respect to punctuation marks such as ?, ! and . but there are many cases and situations that these rules can fail. In NLP area, is there any model or solution that can be applied to reach the mentioned goal?
Category: Data Science

Why does CV yield lower score?

My training accuracy was better than my test accuracy, hence I thought my model was over-fitted and tried Cross-validation. The model further degraded. Is that my input data need to be sanitised further and of better quality? Please share your thoughts what could be getting wrong here. My data distribution: Code snippets... My function get_score: def get_score(model, X_train, X_test, y_train, y_test): model.fit(X_train, y_train.values.ravel()) pred0 = model.predict(X_test) return accuracy_score(y_test, pred0) Logic: print('*TRAIN* Accuracy Score => '+str(accuracy_score(y_train, m.predict(X_train)))) # LinearSVC() used print('*TEST* …
Category: Data Science

WordPress customizer Preview not loading

I'm creating a WordPress website, today I have tried to add some new features but I'm not able to add because customizer live preview is not loading I have done some steps Update all theme and plugin uninstall all the plugin after some time again install all plugin one by one. 3)Take a back up of whole site and reset the website by "WP reset plugin" upload again after sometime. Check the hosting space but not the space problem. check …
Category: Web

How to prepare masks for multiclass semantic segmentation?

It's very straightforward for binary semantic segmentation: black color (0s) is responsible for background, whereas white color (1s) is responsible for objects of interest. But what about multiclass semantic segmentation? As far as I understand, these masks must be RGB images since we use more than two colors. Is it correct? Or should I have a separate binary mask for every class? If I can use RGB images with multiple colors as masks, should I use some specific colors for …
Category: Data Science

Add WordPress user custom meta to chartjs vertically stacked chart in Divi theme

I have created a user dashboard using the Divi theme where I need to add a chart like the attached screenshot. The data are specific for every different user. I have tried many premium plugins but none of them fits my requirement. This is how I added the user meta - <?php function hfa_custom_user_fields( $user ) { $services_subscribed_options = array( 'Airbnb' => 'Airbnb', 'Vrbo' => 'Vrbo', 'Trucking' => 'Trucking' ); $services_subscribed = get_user_meta($user->ID, 'services_subscribed', true); $services_subscribed = (array)unserialize($services_subscribed); $total_invest = …
Category: Web

?cat=-1 Indexed Versions Of Homepage

I'm finding some strange query strings on my homepage are indexed in Google and causing duplicate content. A couple of examples: https://sciencetrends.com/page/103/?cat=-1 https://sciencetrends.com/?cat=-3 I'm not sure how or why these pages are being created in Wordpress but it seems common for even large Wordpress sites: https://techcrunch.com/page/10/?cat=-1 https://blogs.wsj.com/law/page/10/?cat=-1 https://www.nytco.com/page/10/?cat=-1 http://www.bbcamerica.com/page/10/?cat=-1 Ideally, I'd like to remove all ?cat=* pages from the site and have then resolve to 404. Any thoughts on the best method to do so, .htaccess, Wordpress modification, etc.?
Category: Web

How to generate a sentence around words in Keras?

I know that how to generate next word in keras with lstm but how to predict previous word for example If you have two words like "car" and "running" then It should generate "The car is running". How can we do this in keras ? I want to also make sure that generator should stop after completing the sentence. Thank you.
Category: Data Science

Merging development site with live site

Earlier this year I built a client a large website for their organization. After that site was finished and live on the web (not on our development server anymore) they wanted the company I work for to build them another site for their online magazine. I built the site using a copy of the old development site we used for their org since they wanted everything to look the same. Now that the site is finished, we need to integrate …
Category: Web

Detect blur image using ssdmobilenet and tensorflowlite

I have clear images of cards vs blurry images of card. My task is to capture photo when the image is not blurry, as you can see from the description I need this code to run in real time on android device. I have done some background reserarch on this topic 'Identify blurry image'. And found out few interesting solutions. Apply opencv transforms such as laplace or sobel filter. The blurry image will have less edges. And then using techniques …
Category: Data Science

Data Entry Automation with ML

I am working on a data entry task with approximately 6000 entries to go over. The source comes in the form of a string and can look something like this: Air Canada B737 FFS From this I can extract the following information: Company: Air Canada Model: B737 Technology: FFS For my initial plan of attack I iterated over the source strings using Regular Expression to extract as many keywords as possible, the problem is there are so many different Companies, …
Category: Data Science

How to echo a PHP code into WooCommerce variation product?

I have a little complex to explain the problem which I hope someone can understand and help me with. I have set custom fields on WooCommerce which I use to enter a specific code for each product (something like SKU called "asin"), Then i use that code on my backend using Amazon API to get the price from the product page on Amazon (don't worry my question is general and not related to API). Here is a sample of my …
Category: Web

Are there rules of thumb for xgboosts hyperperameter selection?

There are multiple parameters that need to be specified in the XGBClassifier. Certainly gridsearchcv could give some insight into optimal hyperparameters, but I would imagine there are some rules of thumb for some reasonable hyperparameter selection. For example, for a training set of ~200,000 examples with ~1000 features is it possible to specify reasonable values for n_estimators, learning_rate, and max_depth with just this information alone?
Category: Data Science

Scipy curve_fit and method "dogbox"

I am trying to duplicate this papers feature engineering for user activity. They take 14 days of accumulated user activity and keep the parameters (2 parameters) that fit a sigmoid to it. I would like to do the same except with 7 days of activity. http://hanj.cs.illinois.edu/pdf/kdd18_cyang.pdf They use the formula below and keep the parameters x0 and k as features. from scipy.optimize import curve_fit import numpy as np def sigmoid(x, x0, k): y = 1 / (1 + np.exp(-k*(x-x0))) return …
Topic: scipy
Category: Data Science

Get term siblings of current child taxonomy

So my url/slug structure looks like this /toolkit-category/downloads/gui-kits. Within /downloads is other child categories/terms. I am trying to fetch the other siblings of gui-kits when on /gui-kits. "toolkit_category" is the name of my taxonomy that is acting as categories, built using PODS. $queried_object = get_queried_object('term'); $tax = $queried_object->taxonomy; $term = $queried_object->term_id; $parent = $queried_object->parent; $next_items = get_term_children( $term, $tax ); The above code doesnt work, returns nothing? Any help is appreciated :)
Category: Web

Retrieve user features in real time from UserId for prediction

Let's say I'm building an app like Uber and I want to predict the user's most likely destination based on the user's past history, current latitude/longitude, and time/date. Here is the proposed architecture - Let's say I have a pre-trained model hosted as a service. The part I'm struggling with is, how do I get the user features from the database in realtime from the RiderID to be used by the prediction service (XGBoost Model)? I'm guessing a lookup in …
Category: Data Science

Gutenberg: How to display meta field data in the block frontend (save function)

I have some legacy meta fields in my post that I would like to display in my block. I found a documentation for settings meta fields but not how to display them. So I tried this: export default function save( { attributes } ) { const blockProps = useBlockProps.save(); const postType = useSelect( ( select ) => select( 'core/editor' ).getCurrentPostType(), [] ); const [ meta, setMeta ] = useEntityProp( 'postType', postType, 'meta' ); const game_meta = meta[ '_shortscore_game' ]; return …
Category: Web

Allow HTML in Custom Metabox area

I know there are many questions related to my question, but sincerely i was unable to get solution. My question is simple, how can i allow html in textarea in custom metabox on post. So far i have created this code of adding meta boxes. add_action( 'add_meta_boxes_post', function ( $post ) { if ( $post->_wp_page_template === 'page-templates/skyscraper-post.php' ) { add_meta_box( 'sky_post_excerpt', 'SkyScraper Post Excerpt and Links', 'sky_post_excerpts', 'post', 'advanced', 'high' ); } }); add_action( 'save_post', 'post_meta_box_save' ); function sky_post_excerpts() { …
Category: Web

Appropriate statistical test

I am working on a project where I have twitter user profiles and their tweets. The users are divided based on their number of followers in two groups (g1 and g2). Then with each user in g1, one user from g2 were matched based on their profile and activity using nearest neighbor (not propensity score). Now I want to do some statistical tests, for example, how differently the sentiment of the tweets changes for these two groups before and after …
Topic: statistics
Category: Data Science

How to change the output of gallery shortcode

I would like to add the media description as a data-attribute to each image of the gallery. All the other answers favour the solution to copy the whole code from media.php to functions.php and change it there. But isn't there a more intelligent way? It's way to much code duplication in order to change one single line of code!
Category: Web

When to split data into multiple regression models instead of one model?

I'm playing with regression models in scikit-learn. The goal is to predict how much inventory we should purchase for the next 90 days. My data set has hundred of product categories. Each category has many unique features that do not apply to every category. For Example: Shirt category could have "size" and "color" features where as the category Razors could have a "number of blades" feature. Should I split my data up by category and make a different model for …
Category: Data Science

About

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