How to remove anchor of current menu item in navbar?

Wordpress nav menu created by wp_nav_menu can highlight current menu item. How can i strip anchor from current menu item? For example, we have menu: <ul> <li class="current-menu-item"><a href="/somelink">Home</a></li> <li><a href="/elselink">Item</a></li> ... </ul> Can we remove <a href="/somelink"> and leave just "Home" if it is current page? UPD. In my functions.php I have a walker like this: class My_Walker_Nav_Menu extends Walker_Nav_Menu { function start_lvl(&$output, $depth) { $indent = str_repeat("\t", $depth); $output .= "\n$indent<ul class=\"dropdown-menu\">\n"; } } and I've found the …
Category: Web

Generator losses in WGAN and potential convergence failure

I have been training a WGAN for a while now, with my generator training once in every five epochs. I have tried several model architectures(no of filters) and also tried varying the relationship with each other. No matter what happens, my output is essentially noise. On further reading, it seems to be a classic case of convergence failure. Over time, my generator loss gets more and more negative while my discriminator loss remains around -0.4 My guess is that since …
Category: Data Science

NGINX serve Wordpress from sub-path fails with 404, how to fix?

I'd like host review branches for staging, to test and get feedback before publishing to production. I tried to follow some documentation provided online such as the NGINX recipes ( https://www.nginx.com/resources/wiki/start/topics/recipes/wordpress/ ) without success! So, how to fix it? The pattern for the review branches are /review-xxxxx or /review-xx_x-xxx. As I have setup the Deployment pipeline to trigger publishing to AWS ECS for review-* branches and that's where I'd like to keep it private for tests and feedback only. I've …
Category: Web

Training Object Detection model on just 10 images

I am trying to train an object detection model using Mask-RCNN with Resnet50 as backbone. I am using the pre-trained models from PyTorch's Torchvision library. I have only 10 images that I can use to train. Of the same 10 images, I am using 3 images for validation. For the evaluation, I am using the evaluation method used in COCO dataset which is also provided as .py scripts in the TorchVision's github repository. To have enough samples for training, I …
Category: Data Science

R code making 1 column into multiple columns with their unique ID

Currently stuck on a data wrangling question in R. So far I've tried variations of this code using tidyverse package, columns 5 and 6 here were the rating and the user: df[,5:6] %>% pivot_wider(names_from = question, values_from = rating, names_sep = ".") %>% unnest(cols = everything())-> df_reformat Each column will be the question ID and the rows are the scores for each user, ideally clustered by group. Data structure needed: repID user Customer question 1 Customer question 2 .... Customer …
Category: Data Science

Performance with autoload and the options table

I am playing around with the autoload column of the options table. I didn't find much information about how the autoloaded values are used. I tried a print_r($GLOBALS) and saw that the autoloaded options are stored in $GLOBALS['wp_object_cache']->cache['options']['alloptions']. Is there another way to access those variables? Suppose I need to access an option my_option, which was set to autoload, multiple times in different templates (eg. once in header.php, once in footer.php), which method is recommended? Is it okay that I …
Category: Web

Get product price in a different currency using WooCommerce Currency Switcher

I am working on some costume products pages in wordpress and I am having kinda of an issue when outputting the product price, the deal is that I am using a plugin to switch the currency and because I have made a lot template changes I had to go with the normal loop way to output products: foreach($items as $item => $values) { $_product = wc_get_product( $values['data']->get_id() ); //product image $getProductDetail = wc_get_product( $values['product_id'] ); //echo "<b>".$_product->get_title() .'</b> <br> Quantity: …
Category: Web

Add ID information from one dataframe to every row in another dataframe without a common key

I am trying to combine two dataframes into the second dataframe, but duplicating the first dataframe into every row of dataframe two. The first dataframe (df1) contains the identifing information, and the other dataframe (df2) contains data about that identifying information. They are in different dataframes since they come from different files. I am sure there is an easy way to do this, but cant seem to find it. The basic problem is there are no unique identifiers on df2 …
Category: Data Science

Get image thumbnail size urls in media library

WordPress generates several thumbnail sizes and adding custom image sizes in a theme is great, but is there a way to view all URLs for a given image in WP, ideally right in the media library popup? Currently if I want the "large" thumbnail URL of an image, I have to edit/add a Page/Post, add the image to the page, view the text editor and copy the URL out of the inserted <img src="goal_url.jpg" />. Not very convenient! For example, …
Category: Web

Clustering when data is represented by multiple functional forms, all at once

I wish to cluster similar data where I have a collection of many $y$ vs $x$ data. A third variable $z$ also exists, but z doesn't always affect $y$ whereas $x$ always affects $z$. In terms of $x$ and $z$, y has five possible functional forms: $y = \frac{f(x,A)}{g(x,B)}$ $y = \frac{f(x,A)}{g(x,B\times h(z,C))}$ $y = \frac{f(x,A)}{g(x\times h(z,D),B)}$ $y = \frac{f(x,A)}{g(x,B)\times j(z,E)}$ $y = \frac{f(x,A)}{g(x\times h(z,D),B\times h(z,C))}$ One of those forms best describes results from each experimental run i.e. each $y$ …
Category: Data Science

how to open my existing site on mamp

I've got mamp working but can't access my site. I created the DB cheaptubes_com, a user and I successfully imported the DB. I have a copy of information_schema DB but can't find how to import it and I read that I can't import it. I've tried going to localhost, localhost/cheaptubes.com/wp-login.php, localhost:8888 & localhost:80 and other variations. I'm not sure what I'm doing wrong but all I get is a blank install but it knows the site name.
Category: Web

Time series forecast for everyday for till a distant future

I have time-series data for every single day from the last 5 years with seasonal variation and a general increase in trend. This is what my data looks like: And I am trying to predict for every single day for 4-5 years in the future. Approaches I have used currently: LSTM, GRU (but they are extremely prone to overfitting ad I am trying successive predictions which results in massive error accumulation and often flat over time for smaller lookbacks and …
Category: Data Science

Excerpt Length & List Category Posts Plugin

I'm trying to filter out the excerpt by character length for a plugin called "List Category Posts". I've been trying to get the excerpts working for the past week, but nothing is doing the trick. The plugin actually comes with a feature that allows you to post the excerpt or not, then filter it by character length.. by adding "excerpt_size=" in the shortcode. But unfortunately, it doesn't work at this time, and I've tested it with multiple different themes. Anyways, …
Category: Web

Classification or Regression approach?

I have a dataset with x variables and the target y (between 0 and 100%, so 0 and 1) My goal os to predict if a sample is in a group of y [0,0.25), [25,50) or [50,100]. And I am wondering if I should use a classification model and number these groups with 3 labels [0,1,2] or perform a regression to obtain a specific value (e.g. 0,18 or 18%) and get the grouping later. Which approach should be used/yield better …
Category: Data Science

Deep Learning accuracy vs Confusion Matrix accuracy

I am working on deep learning with fer2013 dataset. After training the model I got val_precision: 0.9168 (precision: 0.8492) Epoch 67/100 238/238 [==============================] - 31s 130ms/step - loss: 1.5087 - tp: 2622.4142 - fp: 474.9121 - tn: 45584.3013 - fn: 5054.1213 - accuracy: 0.8972 - precision: 0.8492 - recall: 0.3410 - auc: 0.9042 - prc: 0.6758 - val_loss: 0.9754 - val_tp: 1389.0000 - val_fp: 126.0000 - val_tn: 22698.0000 - val_fn: 2415.0000 - val_accuracy: 0.9046 - **val_precision: 0.9168** - val_recall: 0.3651 …
Category: Data Science

XGBoost for multi-label image classification

I am trying to use the xgboost classifier for a multi-label and multi-class image classification task. I have a list of images that can have up to 5 different labels in each of them. Before I use the classifier I want to also apply image augmentation. import keras from sklearn.model_selection import train_test_split from keras.preprocessing.image import ImageDataGenerator from xgboost.sklearn import XGBClassifier train_idx, val_idx = train_test_split(mask_df.index, test_size=0.2,random_state=28) train_datagen=ImageDataGenerator(zoom_range=0.1, fill_mode='constant', rotation_range=10, height_shift_range=0.1, width_shift_range=0.1, horizontal_flip=True, vertical_flip=True, rescale=1/255.) train_generator=train_datagen.flow_from_dataframe( dataframe=mask_df.loc[train_idx], directory="home/DATA/train_images/", x_col="ImageId", y_col=columns, color_mode='grayscale', batch_size=32, …
Category: Data Science

SciKit-Learn Decision Tree Overfitting

We have a project to utilize a few algorithms we have learned so far. I've been using SciKit-Learn to perform these algorithms, but when it comes to decision trees I keep getting a feeling I am overfitting. I'm using a dataset about the weather, giving characteristics such as city, state, month, year, wind direction, wind speed, etc... where the target variable is the average temperature for the day. Now I know this is hard to classify, as it is pretty …
Category: Data Science

Parent page for CPT

Alright, there's been numerous topics about this, but it doesn't seem to work for me. I have one normal page, called "Resources". Then I have several Custom Post Types. One of which is "Video's". I want "Video's" to be a child page of "Resources". At the moment, I can both access the video's page by the URL: http://example.com/resources/videos AND http://example.com/videos (they both work). My Videos CPT is as follows: function register_custom_post_video() { $labels = array( 'name' => _x('Videos', 'videos'), 'singular_name' …
Category: Web

What algorithms can handle probabilistic targets?

I have a classification problem where I want to want to use probabilities instead of classes to train my model to learn to output probabilities. In my dataset, I have instances where the probabilities of two classes are almost equal and I would like the model to be able to learn these subtleties instead of me just providing the class for each instance. Is there an ML model that can handle this? Thanks!
Category: Data Science

Which LSTM Training Strategy Performs better?

I would like to use LSTM for predicting multiple time series (Time series about sales per day in multiple countries. In parts, contradicting regional trends are present within the data. Sales is the 'dependent' variable, whereas there are multiple other explanatory variables). Now I'm thinking if I should train one "one-fits-all" LSTM model that uses the data of all countries for training or if I should train one LSTM Model for each country (there are 30 different countries in my …
Category: Data Science

predicition for a specific month

I am attempting to build a predictive model based on the past historical data. I have details of specific machine failure based on the past year data. I have data from some months of 2016 and from 2017 January to November. I am attempting to predict if the machine fails in December. I have attached the past historical data based on the data transformation I performed. I am stuck at a point on how to build a model to identify …
Category: Data Science

Background image call problem

I simply can't find the correct way or working way to do this. I've made an alternative header and added an option with redux theme option to have the alternative header. I've also made a custom-css.php where i can enter some files which are output in header. This should override any css from style.css the thing i need is really simple but whatever way i have used, it doesn't work an example .header-fixed { background: transparent url(assets/images/mix1.png) repeat-x; } With …
Category: Web

post_type incorrect for custom post type

I am trying to display a different template depending on the post type. I have registered two custom post types called resource and contact. When I try to get the post type in search.php (using get_post_type()), I always get back resource post type, even when the post is definitely contact. Registering resource function register_resource_post_type() { $args = array( 'labels' => array('name' => __('Resources'), 'singular_name' => __('Resource'), 'add_new_item' => __('Add New Resource')), 'public' => true, 'supports' => array( 'title', 'custom-fields' ), …
Category: Web

Selecting Data from 2 Dimensional Empirical Data Set in Excel

I have a set of efficiency values based on 2 dependent variables (speed and torque). These numbers are provided from the manufacturer and I want to fit the efficiency values to a set of personal test data points (e.g. the singular data point shown in the bottom left of the following image). This image shows my problem (where the efficiency values have been randomized to retain confidentiality): Is there a way to use the RPM (x-axis on data set) and …
Topic: matrix dataset
Category: Data Science

Help wiht adding fullcalendar.io to a WordPress page

I've been trying to add this calendar to my wordpress page. And I've followed the documentation, but it's still not showing up. This is what I've done. I first added this to my child theme functions file: function fullcalendar_jquery_enqueue() { wp_register_script('fullcalendar', "https://cdnjs.cloudflare.com/ajax/libs/fullcalendar/3.9.0/fullcalendar.min.js", false, null, true); wp_enqueue_script('fullcalendar'); } add_action("wp_enqueue_scripts", "fullcalendar_jquery_enqueue", 11); function load_styles() { wp_register_style('fullcalendarcss', 'https://cdnjs.cloudflare.com/ajax/libs/fullcalendar/3.9.0/fullcalendar.min.css'); wp_register_style('fullcalendarprintcss', 'https://cdnjs.cloudflare.com/ajax/libs/fullcalendar/3.9.0/fullcalendar.print.css'); wp_enqueue_style( 'fullcalendarcss'); wp_enqueue_style( 'fullcalendarprintcss'); } add_action('wp_print_styles', 'load_styles'); Then I added this JS to my custom.js file: jQuery(document).ready(function ($) { var calendar = jQuery('#calendar').fullCalendar({ …
Category: Web

My validation loss is too much higher than the training loss is that overfitting?

I am new to data deep learning. I am educating myself but I don't understand this situation. Where Validation loss is much much higher than the training loss. Can someone please interpret this? inputs = keras.Input((width, height, depth, 1)) x = layers.Conv3D(filters=64, kernel_size=3, activation="relu")(inputs) x = layers.MaxPool3D(pool_size=2)(x) x = layers.BatchNormalization()(x) x = layers.Conv3D(filters=64, kernel_size=3, activation="relu")(x) x = layers.MaxPool3D(pool_size=2)(x) x = layers.BatchNormalization()(x) x = layers.Conv3D(filters=128, kernel_size=3, activation="relu")(x) x = layers.MaxPool3D(pool_size=2)(x) x = layers.BatchNormalization()(x) x = layers.Conv3D(filters=256, kernel_size=3, activation="relu")(x) x = layers.MaxPool3D(pool_size=2)(x) …
Category: Data Science

How to refit GridSearchCV on Multiclass problem

I'm trying to use GridSearchCV for my Multiclass problem. For starters, wanted to test it on KNeighborsClassifier. First, here's the code where I define the function which uses GridSearchCV: from sklearn.model_selection import GridSearchCV from sklearn.model_selection import KFold def grid_search(estimator, parameters, X, y): scoring = ['accuracy', 'precision', 'recall'] kf = KFold(5) clf = GridSearchCV(estimator, parameters, cv=kf, scoring=scoring, refit="accuracy", n_jobs=-1) clf.fit(X, y) i = clf.best_index_ best_precision = clf.cv_results_['mean_test_precision'][i] best_recall = clf.cv_results_['mean_test_recall'][i] print('Best score (accuracy): {}'.format(clf.best_score_)) print('Mean precision: {}'.format(best_precision)) print('Mean recall: {}'.format(best_recall)) print('Best …
Category: Data Science

Order WP_Query by meta_key priority when 'OR' relation used for multiple meta values

I have a WP_Query that queries posts by an ACF date field AND an ACF true/false field. I am requesting all posts that have a date field value past the current date OR have the true/false field checked true be returned. It appears like such: $args = array( 'post_type' => 'post', 'posts_per_page' => 6, 'meta_key' => 'event_date', 'orderby' => 'meta_value_num', 'order' => 'ASC', 'cat' => 3, 'meta_query' => array( 'relation' => 'OR', array( 'key' => 'event_date', 'value' => date('Ymd'), 'compare' …
Category: Web

How to get post detail based on URL of the post

I have a custom php page where I need to display details of a WordPress post based on the URL entered from the Admin. In the Admin, when adding the project detail, we enter few URLs of article post which are linked to this project in a text box. The URLs are stored as comma separated values in the database. Through explode I'm able to fetch all of the URLs but I'm not able to get the details of the …
Category: Web

How to treat the undefined values which make sense?

I'm currently trying to create a few features to improve the performances of a model. One of those features that I would like to create corresponds to the difference in days between a customer's purcharse and his last one. To create this feature is not a problem. However, I don't know which value to set if this is the first purcharse of a customer. Which value should I set and, more generally, how to treat these cases ? customer_id date_purchase …
Category: Data Science

multi variate time forecasting

I want to forecast in a time serie the 'output'. I have from the past the correlated time series 'output', 'capacity' and 'load'. I also know from the nearby future the time series from the 'capacity' and 'load'. See picture. I'm looking for a solution to this problem in python. All variable have the same unit in man-hours per hour (mh/h). For your interest; the output is the work that is finished in a skill group based on the baseline. …
Category: Data Science

Genetic Algorithms (Specifically with Keras)

I can't get my deep genetic algorithm snake game to work and I can't figure out why. At this point, I think it must be either the crossover_rate/mutation_rate or the actual crossover code itself is wrong. I'm hoping someone here can help me with figuring out which. So, here's my understanding of deep genetic algorithms: You have a pool of agents. They're randomly generated. You have each of them run, tracking their fitness up until they die. When all agents …
Category: Data Science

About

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