Is there a way to set different confidence thresholds for different classes using Detectron2?

I am working on an object detection model for microscopic images. Some of my classes are very simple (feature wise), they are practically fancy lines. Some are more complicated objects. My problem is that I am getting a lot of False Positives for the simple classes, because anything that looks loke a line gets classified. I am using the Detectron2 framework and I wonder if there is a way to set a higher confidence threshold for the simple classes?
Category: Data Science

Machine learning with constraints on features

I am working on a learning to rank problem. I have queries and documents related to every query which I have to rank. I used lightgbm ranker to fit the model. Some of features are very important and if they are changed the fitted model predicts a better score for that document and thus a better rank. Lets say, for a single query id, I have a group of documents d1....d5 each having features f1...fn. I change the features f1,f2,f3 …
Category: Data Science

removed index.php now all pages 404

I added this code to my .htaccess file to get rid of index.php, but now all the pages 404 (the hyperlinks are mapped to the correct url) # BEGIN WordPress <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] </IfModule> # END WordPress i set up my permalinks using http://1.1.1.1/%postname%/ what are the next steps in order to troubleshoot this issue? what is the default permalink for me to …
Category: Web

how to tune hyperparameters inn regression neural network

hope you are enjoying good health,i am trying to built a simple neural network which has to predict a shear wave well log values from other well logs,but my model's is stuck in mean absolute error of 2.45 and it is not improving further,i have changed the number of neurons,learning rate,loss function but of no use. Here is my model: tf.random.set_seed(42) model=tf.keras.Sequential([ tf.keras.layers.Dense(22,activation='relu'), tf.keras.layers.Dense(1) ]) #commpiling: model.compile( loss=tf.losses.mae, optimizer=tf.optimizers.Adam(learning_rate=0.006), metrics=['mae'] ) #fitting: history=model.fit(x_train,y_train,epochs=1000,verbose=0,) #evaluation: model.evaluate(x_test,y_test) here is the boxplot of …
Category: Data Science

Change quantity via jQuery and disabile quantity field

I have products where I need to disable the quantity field on the product detail pages and dynamically change the quantity based on another value. I change the value using this code: if (jQuery('body').hasClass('is-adapt-quantity-product')) { jQuery('.wc-pao-addon-custom-textarea').bind('keyup', _.debounce(function(){ jQuery(".qty").val(parseInt(jQuery(this).val().length)); }, 500)); } This works fine. The quantity changes and if I click on the "add to cart" button, I have the quantity in my cart. When I add this to the js code: jQuery(".qty").attr("disabled", "disabled"); The quantity on the product detail …
Category: Web

How to find the dependent variables from a dataset?

I am stuck at where how can I get the most dependent variables based on the mean I have this dataset and when I try to: df.groupby('left').mean() It gives the output: And one of my friends said, from that graph the dependent variables for the attribute left will be 1.Satisfaction Level 2.Average Monthly Hours 3.Promotion Last 5 Years I am wondering How could someone guess that?
Category: Data Science

Add/change multipart_params parameter when uploading post image

I'm working on plugin that optionally manipulates uploaded content (images). I managed to add some additional fields on "Insert media" popup under "Drop files anywhere to upload" text, but I need to send those parameters with file content to async-upload.php when uploading. Pre WP v3.3, I've been using this to achive desired results: jQuery('input:text[name="custom_text"]').keyup(function() { wpUploaderInit.multipart_params.custom_text = jQuery(this).val(); });
Category: Web

Python: calculate the weighted average correlation coefficient

I am calculating the volatility (standard deviation) of returns of a portfolio of assets using the variance-covariance approach. Correlation coefficients and asset volatilities have been estimated from historical returns. Now what I'd like to do is compute the average correlation coefficient, that is the common correlation coefficient between all asset pairs that gives me the same overall portfolio volatility. I could of course take an iterative approach, but was wondering if there was something simpler / out of the box …
Category: Data Science

Why does hyperparameter tuning occur on validation dataset and not at the very beginning?

Despite doing/using it a few times, I'm still slightly confused by the use of a validation set for hyper parameter tuning. As far as I can tell, I choose a model, train it on training data, assess performance on training data, then do hyper parameter tuning assessing model performance on validation data, then choose the best model and test this on test data. In order to do this, I basically need to pick a model at random for training data. …
Category: Data Science

Ordering a material science dataset (properties names, properties scalars, formulas)

I'm dealing with a materials science dataset and I'm in the following situation, I have data organized like this: Chemical_ Formula Property_name Property_Scalar He Electrical conduc. 1 NO_2 Resistance 50 CuO3 Hardness ... ... ... CuO3 Fluorescence 300 He Toxicity 39 NO2 Hardness 80 ... ... ... As you can understand it is really messy because the same chemical formula appears more than once through the entire dataset, but referred to a different property that is considered. My question is, …
Category: Data Science

Return value of $wpdb->update() query in plugin is wrong

The return value of my update query on an empty database table is wrong even though my query syntax seems to be right. The ELSE statement is executed when I run the query on an empty table but no update entry is made in the table. What may be wrong? if($wpdb->update( 'wp_counter_cookies', array( 'visit' => current_time( 'mysql' ), // string ), array( 'cookie' => $counter_cookie ), array( '%s' // value1 ), array( '%s' ) )=== FALSE) { $table_name = $wpdb->prefix …
Category: Web

Invoice plugin recommendation

could you recommend a wordpress plugin (free or paid) that can be used to create an invoice on the fly by the owner of a shop and also would work for woocommerce as the same time? Meaning the plugin can generate invoice (incremental invoice number) for woocommerce but also we can create an invoice if needed to by adding the customer name etc. Thanks for your help.
Category: Web

alt, title tags not showing

I have added alt tags, title and description on all the images on my website but none are showing when I check them in the inspect element tool in chrome or firefox. Here's a screenshot: And here's the screenshot of inspect element of the same image:
Category: Web

Relationships between groups of features against independent variables

I have several groups of features that I'd like to test against independent variables. The idea is to find which groups tend to be associated with a specific value of an independent variable. Let's take the following example where s are samples, f are features, i are independent variables associated with each s. s1 s2 s3 s4 .... f1 0.3 0.9 0.7 0.8 f2 ... f3 ... f4 ... f5 ... i1 low low med high i2 0.9 1.6 2.3 …
Category: Data Science

Calculating new centroids when the centroids are chosen at random

When given two random points which are not instances in the dataset should I include the centroids in my calculations for the new centroids? For example in this link they are using the starting centroids which are apart of the dataset to calculate the mean for the new centroids. But if given random x and y coordinates lets say [2,1] and [3,2] which are not apart of the dataset do I also include them or just the instances in the …
Category: Data Science

Fill the null values in the dataframe with condition

traindf[traindf['Gender'] == 'female']['Age'].fillna(value=femage,inplace=True) I've tried to update the null values in the age column in the dataframe with the mean values.Here I tried to replace the null values in the age column of female gender with the female mean age.But the column doesn't get updated.why?
Topic: pandas python
Category: Data Science

Admin bar and fixed header issue?

I've styled my header to have a fixed top position. While logged in to wordpress, the wp admin nav bar covers the top section of my header making imposible to access my top navigation. I would like for the wp admin nav to push my top navigation below so both are visible. Does anyone know of any solution to fix this problem? An example of my problem can be found at... www.nickriversdesign.com/dev
Category: Web

Contextual Spell Correction

I want to create a spell checker that corrects the spelling mistakes contextually. For example, Erroneous sentence: I want to apply for credit cart Corrected sentence: I want to apply for credit card Here, the respective spellings of cart and card are correct but the cart is contextually incorrect. So what methods we can apply for contextual errors like this?
Category: Data Science

How to show a feed that requires user/pass within a sidebar widget?

I'm trying to do something and I don't seem to yield any successful results when searching neither at wordpress.org forums nor here. I would like to extend the standard RSS widget so that I can set an user/password for HTTP Authentication in order to fetch the feed items. If there is an existing solution that I'm missing and already provides this feature, any pointer will be much appreciated. Thanks.
Category: Web

Building a graph out of a large text corpus

I'm given a large amount of documents upon which I should perform various kinds of analysis. Since the documents are to be used as a foundation of a final product, I thought about building a graph out of this text corpus, with each document corresponding to a node. One way to build a graph would be to use models such as USE to first find text embeddings, and then form a link between two nodes (texts) whose similarity is beyond …
Category: Data Science

extract features from parts of one image

I have several parts of one image that have one caption... I need to do image captioning by evaluating every part of the image to which the caption will belong so do I need to extract the features from parts of the image and pass it to the model with its caption ? or how can I do it please? for example; the dataset I have are the parts of the image which are divided into three parts “beach, sea, …
Category: Data Science

log mel energies

I want to convert mel spectogram to log mel energies what I used is y, sr = librosa.load(filename, sr=16000) mel_spectrogram = librosa.feature.melspectrogram( y=y, sr=sr, n_mels=128, n_fft=1024, hop_length=512, power=2) log_mel_spectrogram = librosa.power_to_db(mel_spectrogram) I thought this converts to mel energies but I found this line of code log_mel_spectrogram = 20.0 / power * np.log10(np.maximum(mel_spectrogram, sys.float_info.epsilon)) My question is what is the difference between log-mel spectrograms and log mel energies, which line of code to use
Category: Data Science

Is this a case of overfitting?

I am training a CNN-LSTM-FC network with around 1 Million parameters network for spatial time series prediction but the validation loss does not even come close to the training loss after 1-2 epochs. Is this a clear case of overfitting? Any inputs would be appreciated! I am using keras with tensorflow backend.
Category: Data Science

Wordpress multisite subdirectory redirect infinite loop issue

Any time I create a new site on my multisite install, I get an infinite loop redirect when navigating to that site's admin. I'm using the default htaccess supplied by WP for my subdirectory install. Here's what I have: RewriteEngine On RewriteBase / RewriteRule ^index\.php$ - [L] # add a trailing slash to /wp-admin RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L] RewriteCond %{REQUEST_FILENAME} -f [OR] RewriteCond %{REQUEST_FILENAME} -d RewriteRule ^ - [L] RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) site/$2 [L] RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ site/$2 [L] RewriteRule . index.php …
Category: Web

Workaround for og:image unsupported webp image type, Yoast SEO?

My site Beta Fox uses Yoast SEO plugin to help deal with SEO common practices, however an issue has arisen. In beginning of last year WordPress didn't fully support webp image types, neither Yoast SEO. Things changed near the end of year, but Yoast SEO unbelievably refuses to support webp (the types Google is forcing upon on us to use). The problem is the fact there's no open graph for image attachments in any page of the site, so that …
Category: Web

Regression sequence output loss function

I am fairly new to deep learning, and I have the following task. Based on an audio sequence of shape (200, 1024), I have to predict two sequences of shape (200, 1) of continuous values (for e.g 0.5687) that represent the emotion at each timestep (valence "v" and arousal "a"). So I've created the following LSTM: inputs_audio = Input(shape=(200, 1024)) audio_net = LSTM(256, return_sequences=True)(inputs_audio) audio_net = LSTM(256, return_sequences=True)(audio_net) audio_net = LSTM(256, return_sequences=False)(audio_net) audio_net = Dropout(0.3)(audio_net) final_model = audio_net target_names = …
Category: Data Science

Difference Between Performance Scores

I need some help to understand the meaning between these different scores. Currently, I am doing the classification problems using machine learning, and I have obtained the results for the classification as shown in the image below. To obtain the results like in the image I use the code: from sklearn.metrics import classification_report, confusion_matrix, accuracy_score print(confusion_matrix(y_test,y_pred)) print(accuracy_score(y_test,y_pred)) print(classification_report(y_test, y_pred)) Then I also try to use the code below to get the recall, precision and f1-score print(precision_score(y_test,y_pred)) print(recall_score(y_test,y_pred)) print(f1_score(y_test,y_pred)) Results : …
Category: Data Science

Get meta information from post parent

So I am in a single page and I want to get some meta information from a parent page. This code is inside my footer.php: if (is_single()) { global $post; $parent = get_post_achestor ( $post->ID ); $some_value = get_post_meta( $parent, 'some_metabox_param', true); } It's not working people, can you please have a look? UPDATE: the parent page in question is template that has this loop <?php query_posts( 'post_type=post&posts_per_page=5&paged=1' ); if ( have_posts() ) : global $more; ?> <div class="items"> <?php …
Category: Web

Woocommerce pre_get_posts query variation meta data not working

In wordpress I made a simple plugin that adds a function to the pre_get_posts hook. I need to be able to search products by their variation sku. The query seems to work as when I var_dump the posts returned by the WP_Query they actually include the correct posts(products). But the search result page doesn't show them and display "No products were found matching your selection." no matter what theme I use. The code I tied: function awesome_plugin_init() { function is_woocommerce_really_activated() …
Category: Web

How to choose threshold for gensim Phrases when generating bigrams?

I'm generating bigrams with from gensim.models.phrases, which I'll use downstream with TF-IDF and/or gensim.LDA from gensim.models.phrases import Phrases, Phraser # 7k documents, ~500-1k tokens each. Already ran cleanup, stop_words, lemmatization, etc docs = get_docs() phrases = Phrases(docs) bigram = Phraser(phrases) docs = [bigram[d] for d in docs] Phrases has min_count=5, threshold=10. I don't quite understand how they interact, they seem related? Anyway, I see threshold having values in different tutorials ranging 1->1000, described as important in determining the number of …
Category: Data Science

Add %post_id% to slug of custom post type and prevent the "unique slug" thing that WP does?

I have a custom post type called "equipment". I would like the permalink structure to be: example.com/equipment/%post_id%-slug I specifically want it to use a dash and not a slash (i.e. - "id-slug" not "id/slug"). Every possible solution I've found from googling has used slashes and I just can't get it to work with a dash. I also want to prevent WordPress from adding on the additional number if there's two posts with the same title. Example: example.com/equipment/45-awesomeness and example.com/equipment/46-awesomeness-2 I …
Category: Web

Can i have the input to a neural network be a set of 2d coordinates if i run them through a convolution layer?

I asked this question a few days ago with no response and still dont have an answer so i will ask again. I am training a reinforcement learning agent on a 2d grid. It is fed in its position, and the target positions using x,y coordinates. An example input would be like [[1,3],[2,2],[5,1]]. I thought that since if i just fed in the input with a flatten layer (would be 1,3,2,2,5,1), there would not be a strong enough association between …
Category: Data Science

partial fitting, how to ensure one hot captures all features consistently

Doing some data science on ~4 million samples, with lots of columns being categorical. One column has ~1000 categories and my boss insists on including it in the analysis. My output is also predicting classes (I'll use gnb.predict_proba()) So, I'm taking a random subset of my data for partial fitting, and repeating. # train = ~3 million rows of data as a dataframe gnb = naive_bayes.GaussianNB() for i in range(10): dds = train.sample(n=10**4) (dfX,dfY) = makeXY(dds) #gets one-hot- encoded X …
Topic: pandas python
Category: Data Science

About

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