Custom comments list, right depth

I created a custom comments_list() function, it works fine, the only problem is to show child comments inside the parent div. It works well with first and second depth levels but not for others. This is my code: /* ----------------------------------------------------------------------------- * Comments custom functions * -------------------------------------------------------------------------- */ //Custom comments lst function t_one_comments_list( $comment, $args, $depth ) { $GLOBALS['comment'] = $comment; switch( $comment->comment_type ) : case 'pingback' : case 'trackback' : ?> <li <?php comment_class(); ?> id="comment<?php comment_ID(); ?>"> <div class="back-link"><?php …
Category: Web

Make the home page's slug visible in the browser's URL bar

Is it possible to show the WordPress home page slug visible in the URL bar? I mean when someone visits my WordPress website home page rather than displaying (considering that my website URL is website.com) "website.com" it must shows "website.com/home-slug" in the browser URL bar. Note: I am using a static page as the home page and my permalink uses "post-name". I am not looking for a way to hide the home slug but a way to make it visible …
Category: Web

How to train LGBMClassifier using optuna

I am trying to use lgbm with optuna for a classification task. Here is my model. from optuna.integration import LightGBMPruningCallback import optuna.integration.lightgbm as lgbm import optuna def objective(trial, X_train, y_train, X_test, y_test): param_grid = { # "device_type": trial.suggest_categorical("device_type", ['gpu']), "n_estimators": trial.suggest_categorical("n_estimators", [10000]), "learning_rate": trial.suggest_float("learning_rate", 0.01, 0.3, log=True), "num_leaves": trial.suggest_int("num_leaves", 20, 3000, step=20), "max_depth": trial.suggest_int("max_depth", 3, 12), "min_data_in_leaf": trial.suggest_int("min_data_in_leaf", 100, 10000, step=1000), "lambda_l1": trial.suggest_int("lambda_l1", 0, 100, step=5), "min_gain_to_split": trial.suggest_float("min_gain_to_split", 0, 15), "bagging_fraction": trial.suggest_float( "bagging_fraction", 0.2, 0.95, step=0.1 ), "bagging_freq": trial.suggest_categorical("bagging_freq", [1]), …
Category: Data Science

Wordpress tinyMCE Keep Wrapping <p> Tags To HTML Codes When Saving

Wordpress tinyMCE keep adding &lt;p&gt; tags when I saved my custom post types in visual mode opened! I had searching for many solutions, but not working. Here is the solution that I found, but this is unable to stop wordpress from adding annoying &lt;p&gt; tags from my html codes: Javascript: &lt;script type="text/javascript"&gt; tinyMCE.init({force_p_newlines : false}); &lt;/script&gt; PHP function tinymce_remove_root_block_tag( $init ) { $init['wpautop'] = false; $init['force_p_newlines'] = false; $init['forced_root_block'] = false; return $init; } add_filter( 'tiny_mce_before_init', 'tinymce_remove_root_block_tag' ); I don't …
Category: Web

Chi-square as evaluation metrics for nonlinear machine learning regression models

I am using machine learning models to predict an ordinal variable (values: 1,2,3,4, and 5) using 7 different features. I posed this as a regression problem, so the final outputs of a model are continuous variables. So an evaluation box plot looks like this: I experiment with both linear (linear regression, linear SVMs) and nonlinear models (SVMs with RBF, Random forest, Gradient boosting machines ). The models are trained using cross-validation (~1600 samples), and 25% of the dataset is used …
Category: Data Science

Login with Username (or Code) only

We are building a landing page site (only 2 pages total) for a client where they are physically mailing out access codes to specific customers. Therefore, I am trying to create a login system where ideally, a user logs in with a pre-determined access code. I have been trying different hacks of a login type of but nothing is working to create a single-step, simple process. The "verification" system that this site uses is close to what I'm looking for, …
Category: Web

Training Inception V3 based model using Keras with Tensorflow Backend

I am currently training a few custom models that require about 12Gb GPU memory at the most. My setup has about 96Gb of GPU memory and python/Jupyter still manages to hog up all the gpu memory to the point that I get the Resource exhausted error thrown at me. I am stuck at this peculiar issue for a while and hence any help will be appreciated. Now, when loading a vgg based model similar to this: from keras.applications.vgg16 import VGG16 …
Category: Data Science

Theoretical work on validity of restricting movement of Centroid of K-Mean

I recently received a manuscript for review in which author used ~1000 "fake" data points, so that the final centroid of K-mean stays within the required range. Neither me nor the author seems to have background in data science and the paper is more of application into our research area. I have tried to find published work related to such method of restricting k-mean centers, but failed to do so. However, on simple logic, it seems like valid way, so …
Topic: k-means
Category: Data Science

PHP, Creating a dynamic variable

Is there any way through which I can declare the dynamic variable in php. for eg, I am using a for loop and the variable name is $message. and I want to add some dynamic data at the end of the variable name. code is below foreach ($quant as $quantity) { $message.$quantity['type'] = 'Listing ID : '.$quantity['product_id'].' With Quantity: '.$quantity['quantity'].'MT, State- '.$quantity['state_name'].' and Coal type-'.$quantity['coal_type'].'&lt;br&gt;'; } so if the $quantity['type'] = 1, then the variable name should be $message1 and …
Category: Web

Online wc-blocks-style.css rendering instead of the hosted wc-blocks-style.css

On my archive page is a sidebar which has a style I want to edit. On my local machine, the style is in wc-blocks-style.css. I edited it successfully and it renders fine. However, after deployment of the website to CPanel, the style is being rendered from an online wc-blocks-style.css. The style link is as follows: &lt;link rel='stylesheet' id='wc-blocks-style-css' href='https://c0.wp.com/p/woocommerce/6.5.1/packages/woocommerce-blocks/build/wc-blocks-style.css' media='all' /&gt;. All other Woocommerce styles are also loaded from this online repository. My question is, how do I make my …
Category: Web

How To Retrieve An Image Attachment's Alt Text?

I am using an attachment.php file to show large versions of images that have been clicked on elsewhere. I'd like to pull the image alt text as a caption under the image with javascript, but the alt text isn't included when when wp_get_attachment_image_src() is used. I don't think WP has a function to retrieve it, so I need my own. To write that function I need to know...Where is the alt text for an image stored? My attachment page uses …
Category: Web

Strategy for achieving a “hybrid” GAN

I have worked with a few GAN-like algorithms, but always with similar inputs and outputs. Being only a novice in deep learning, I often work by adapting an already existing Notebook, but today I have a more complex problem and I cannot find a similar example. For my algorithm I need to predict a curve, which is a list of floats (e.g. dimension 20x1), from two types of input data; a 2D image (e.g. a 16x16 normalized float array) and …
Category: Data Science

Does lightGBM handle multicollinearity?

I have a dataset after feature selection of around 6500 features and 10,000 data rows. I am using LightGBM model. I want to know if I should check the feature set for multicollinearity. If two or more features are correlated how does it affect the tree building and classification prediction How does LightGBM deal with multicollinearity? Does it have any adverse effects?
Category: Data Science

Queries regarding feature importance for categorical features

Queries regarding feature importance for categorical features: Context: I have almost 185 categorical features and these categorical features have either 2 or 3 or 8 or 1 or sometimes 4 categories, null's also. I need to select top 60 features for my model. I also understand that features needs to be selected based on business importance OR feature importance by random forest / decision tree. Queries: I have plotted histograms for each feature (value count vs category) to analyse. What …
Category: Data Science

Co-author plus question about event

I am unable to find an answer to this so I'm trying my luck here. Is there a way to get the coauthor the moment it's added as a coauthor? I want to trigger an event exactly when the author gets added.
Category: Web

Restrict Custom Post Type per role in Dashboard

I would like to set up some restrictions on how some roles can access given posts to edit in Dashboard. I have a custom post type affiliates having 2 nested levels. Custom Role User Editor should be able to edit under a level all posts but the normal editor should have access just on items defined by a custom field relation user - post_id Is there an easy way to implement this
Category: Web

Input-depending model on TensorFlow

I'm working on a TensorFlow model, and I would like to have different logic in the model depending on the input. My question is if it's possible to have a &quot;dispatch&quot; layer in TensorFlow that depending on the input uses one model or another? Simplified example: Imagine your input has two fields a: int and b: Optional[int]. This means b can be defined or not. If b is not None you want to execute some layers, and if it's None …
Category: Data Science

Is there a template file to list all terms of a given custom taxonomy?

Suppose we registered the composers and the interprets custom taxonomies. The composers taxonomy could have the following terms: Wolfgang Amadeus Mozart Ludwig van Beethoven Richard Wagner The interprets taxonomy could have the following terms: Glenn Gould Daniel Barenboim Vienna State Opera I am wondering whether the WordPress template hierarchy has a special file , like taxonomy-terms.php, to list taxonomy terms with a simple loop: &lt;?php while ( have_posts() ) : the_post(); the_title(); endwhile; ?&gt; This would print (assuming the /%postname%/ …
Category: Web

How to get the expected output shape from a unet model?

I have an image segmentation task where my input image shape is (140, 85, 95, 4) and the output label shape is (140, 85, 95). Below is my model: from tensorflow.keras.layers import Conv2D, Conv2DTranspose, Input, Rescaling num_classes = 4 my_model = tf.keras.Sequential([ Input(shape = (85, 95, 4), name = 'image'), Rescaling(scale = 1./255), Conv2D(filters = 64, kernel_size = 3, strides = 1, activation = 'relu', padding = 'same'), Conv2D(filters = 64, kernel_size = 3, activation = 'relu', padding = 'same'), …
Category: Data Science

WordPress 6.0 upgrade caused my custom function to stop working

Not working on WordPress 6.0: https://thealliance.health/for-providers/resources/provider-news-archives/ Working dev site on WordPress 5.9.3: https://ccahdev.wpengine.com/for-providers/resources/provider-news-archives/ Here is the function if somebody can spot what may have been deprecated: function wpb_postsbycategory2022() { $posts = get_posts( array( 'category_name' =&gt; 'Provider News', 'nopaging' =&gt; true, 'orderby' =&gt; 'date', 'order' =&gt; 'DESC', // it's DESC; not DSC // There's no use setting posts_per_page when nopaging is enabled. // Because posts_per_page will be ignored when nopaging is enabled. ) ); $_year_year = ''; // previous years value …
Category: Web

How to get authors who have added the post in the specific custom post type

I have a custom post called event and I have to show all the authors who have added the post. I have tried the below code but I am getting all the users on the page. For example. There are 4 users called A, B, C, and D on the website and A and B added the post. Now I have to get only A and B users but below code getting all the users like A,B,C,D Any idea how …
Category: Web

How to assign costs to the confusion matrix

I am trying to assign costs to the confusion matrix. That is, in my problem, a FP does not have the same cost as a FN, so I want to assign to these cases a cost &quot;x&quot; so that the algorithm learns based on those costs. I will explain my case a little more with an example: When we want to detect credit card fraud, it does not have the same cost to predict that it is not fraud when …
Category: Data Science

Traffic prediction using lstm

I am using LSTM model to predict the data traffic in every second of a base station. The dataset is as follows: The test and train prediction looks as follows: And the RMSE values for train score and test score are 32.54 and 30.03 respectively. To reduce the RMSE values I have changed the lookback value to 15,20 and 30 but it's not reducing. Can somebody tell me the reason behind this huge prediction error and some advice on how …
Category: Data Science

Create a custom calculator in wordpress

I am new to Stack exchange as well as Wordpress. So I don't know if i am in right place asking this question. I am writing a technical blog on my wordpress site and in that blog i want to include a custom calculator where users on entering values of 3 mentioned variables, the calculator will predict the outcome of the dependent variable. Suppose for example Y = 5X + 4T. I want to build a calculator in my blog …
Category: Web

Evaluate a model based on precision for multi class classification

I have a model that predicts the level of injury over 3 classes: Low, Medium and High. I wish to optimize the model parameters on the scoring basis of precision. However, precision is class specific, we can determine the precision of low, medium and high separately. Is there a way to determine something like "Overall Precision" from the confusion matrix?
Category: Data Science

How to fit a model on validation_data?

can you help me understand this better? I need to detect anomalies so I am trying to fit an lstm model using validation_data but the losses does not converge. Do they really need to converge? Does the validation data should resemble train or test data or inbetween? Also, which value should be lower, loss or val_loss ? Thankyou!
Category: Data Science

Classification Produces too Many False Positives or False Negatives

I trying to classify this data set (https://www.kaggle.com/datasets/fedesoriano/stroke-prediction-dataset) to classify if a patient is at risk for having a stroke. As the title says, whatever test I run to classify the patients, I keep running into the final results having too many false-positives or too many false-negative results. The data itself is severely imbalanced (95% 0s to 5% 1 (had a stroke)) and in spite of doing various things to try and balance it or compensate for it, I keep …
Category: Data Science

Layout changes on phone when held as landscape vs portrait

For some reason http://factualfiction.com/marsartists/ displays correctly on a phone when held in landscape position, but not in the normal portrait position. The site uses an old 2012 child-theme and I'm unsure of how this recent problem originated, but wondering if there is a quick fix...? Thank you
Category: Web

Inference from text data without label or Target

I have a use case where I have text data entered by an approver while approving of some loan. I have to make some inferences as to what could be the reasons for approval using NLP. How should I go about it? It's a Non english language. Can Clustering of text help?? Is it possible to cluster TEXT OF non English language using python libraries.
Category: Data Science

Installing WordPress in a subdirectory with static HTML sites

I did a quick search on here and Google and can't really find something helpful. This question here doesn't fit my bill either. I create websites for small business/startups/persons that rarely change content. With my HTML/CSS/PHP knowledge I prefer to build the static pages from scratch so that I can control every single aspect of it (I am aware I could write WP themes but I see it rather redundant and an overkill). I simply don't like to use WP …
Category: Web

When to use Random Forest over SVM and vice versa?

When would one use Random Forest over SVM and vice versa? I understand that cross-validation and model comparison is an important aspect of choosing a model, but here I would like to learn more about rules of thumb and heuristics of the two methods. Can someone please explain the subtleties, strengths, and weaknesses of the classifiers as well as problems, which are best suited to each of them?
Category: Data Science

Improving prediction accuracy with XGBoost

I have a 32x20 matrix for which I am trying to use XGBoost (Regression). I am looping through rows to produce an out of sample forecast. I'm surprised that XGBoost only returns an out of sample error (MAPE) of 3-4%. When I run the data through other algorithms (glmboost, boosted linear model), I get MAPEs around 1.8-2.5%. I'm surprised XGBoost is so deficient. I suspect I am under-optimizing hyperparameters. I include a gridsearch, which I ran below, but the error …
Category: Data Science

About

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