Redis Practical Combat | Use Redis’s Sorted Set to implement the ranking function and integrate with Spring Boot

A collection of columns that you can save for emergencies Spring Cloud practical column: https://blog.csdn.net/superdangbo/category_9270827.html Python practical column: https://blog.csdn.net/superdangbo/category_9271194.html Logback detailed explanation column: https://blog.csdn.net/superdangbo/category_9271502.html tensorflow column: https://blog.csdn.net/superdangbo/category_8691332.html Redis column: https://blog.csdn.net/superdangbo/category_9950790.html Spring Cloud actual combat: Spring Cloud Practical Combat | Decrypting the underlying principles of Feign, including practical source code Spring Cloud Practical Combat | Decrypting […]

Calculate the percentage of the tree structure, construct the tree, sort the ranking

package org.jeecg.modules.statistics.service.impl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import jodd.util.StringUtil; import org.jeecg.common.config.IotDBSessionConfig; import org.jeecg.common.utils.IotResultUtil; import org.jeecg.modules.alarm.service.IEmElectricityAlarmRecordService; import org.jeecg.modules.basic.entity.EmBasicRegion; import org.jeecg.modules.basic.service.IEmBasicRegionService; import org.jeecg.modules.basic.vo.EmBasicRegionVo; import org.jeecg.modules.device.entity.EmElecMeter; import org.jeecg.modules.device.service.IEmElecMeterService; import org.jeecg.modules.statistics.mapper.DeviceRankingMapper; import org.jeecg.modules.statistics.query.DeviceRankingQuery; import org.jeecg.modules.statistics.service.DeviceRankingService; import org.jeecg.modules.statistics.util.SankeyGraph; import org.jeecg.modules.statistics.util.SankeyGraphConverter; import org.jeecg.modules.statistics.vo.DeviceRankingVo; import org.jeecg.modules.statistics.vo.ModbusRegisterVo; import org.jetbrains.annotations.NotNull; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.text.DecimalFormat; import java.util.*; import java.util.stream.Collectors; @Service public class DeviceRankingServiceImpl extends ServiceImpl<DeviceRankingMapper, DeviceRankingQuery> […]

Redis implementation of ranking ideas

Redis implementation ranking ideas Those who read this article must have just learned redis. This article is the ranking function implemented by the blogger after learning redis. It uses the tp6 framework. Other web frameworks can be configured by themselves! Redis implementation ranking ideas Redis implementation of ranking ideas 1. tp6 configure redis cache `config\cache.php` […]

The self-developed framework has entered the global JS framework list, ranking closely behind React and Angular!

Foreword An important goal was finally achieved! Strve, the JavaScript framework I developed independently, recently released a major version 6.0.2. It has been nearly two months since the last major version was released. During this period, a large number of optimizations were carried out, which greatly improved the performance and stability of the framework. In […]

Information retrieval and data mining | [Experiment] Ranking retrieval model

Article directory Experimental content Related concepts Experimental steps Word segmentation preprocessing Build an inverted index table Calculate the similarity between query and each document queries preprocessing and retrieval functions Perform lexical analysis and standardization on the input text Retrieval function Debugging results Experimental content Implement the most basic Ranked retrieval model based on Experiment1 Input: […]

Rust Algorithm Ranking – Selection Sorting Illustration and Code Implementation

Iheardthatyouarealmostgettingmoldyfrombeingboredathome,sowhydon’tyoutrysomethingfresh?Concentrateandmaketimepassfaster! Thefollowingisthesortingprocessandanimationdiagramfromthenovicetutorial: First,findthesmallest(large)elementintheunsortedsequenceandstoreitatthestartingpositionofthesortedsequence. Thencontinuetofindthesmallest(largest)elementfromtheremainingunsortedelements,andthenputitattheendofthesortedsequence. Repeatuntilallelementsaresorted. Let’stakealookatit.Themainlogicofselectionsortingis: Theouterloopfirstspecifiesanumber,usuallythefirstnumber Thenintheinnerloop,comparethenumberspecifiedintheouterloopwiththenumberontherightonebyone,andrecordthesmallestnumberamongthenumbersontheright. Theleftsideisthesortedelements,sothecomparisonintheinnerloopistocontinuouslycomparethenumberspecifiedintheouterloopwiththeelementsontheright. Duringtheinnerloop,everytimeanumbersmallerthanthenumberspecifiedintheouterloopisfound,itwillberecorded.Aftertheloopends,thenumberrecordedwillbethesmallestnumberontheright. Aftertheinnerloopends,exchangethenumberspecifiedbytheouterloopwiththesmallestnumberontherightsideobtainedbytheinnerloop. Andsoonuntiltheouterloopends Nowwehaveasetofelementsthatneedtobesorted: [7,21,9,13,109,9,2,50,33,-1,20,11] Thelogicalouterloopofselectionsortspecifiesthefirstnumber7withindex0.Afterselection,theforloopwillstartloopingfromtheelementwithindex0.Thecodebehavesas: foriin0..vectors.len(){} Theforloopstartsfromthefirstnumber7atindex0.Intheinnerloop,comparethenumberspecifiedbytheouterloopwiththenumberontheright[21,9,13,109,9,2,50,33,-1,20,11]onebyone.WhenthenumberspecifiedbytheouterloopislessthantheelementontheleftRecordtheminimumvalue,andvectors[i]andvectors[j]exchangepositionsaftertheinnerloopends.Theminimumnumberinthisroundis-1,sotheelementgroupbecomes: [-1,21,9,13,109,9,2,50,33,7,20,11] Atthispoint,enterthenextouterloopandspecifythesecondnumber21withthesubscript1.Intheinnerloop,comparethenumberspecifiedbytheouterloopwiththenumberontheright[9,13,109,9,2,50,33,-1,20,11]onebyone.Whenthenumberspecifiedbytheouterloopislessthantheelementontheleft,recordtheminimumvalue,vectors[i]andvectors[j]exchangepositionsaftertheinnerloopends.Theminimumnumberinthisroundis2,sotheelementgroupbecomes: [-1,2,21,13,109,9,9,50,33,7,20,11] Byanalogywiththisrule,thefinalresultofelementsortingis: [-1,2,7,9,9,11,13,20,21,33,50,109] Specificcodeimplementation Firstdefineasetofelementsandprint: fnmain(){ letmutvectors=vec![7,21,9,13,109,9,2,50,33,-1,20,11]; println!(“vectors:{:?}”,vectors); } Thendefinethesortingmethod: fninsert_sort(vectors:&mutVec<i32>)->&Vec<i32>{ vectors } Theouterloopofthesortmethodisaforloop: fninsert_sort(vectors:&mutVec<i32>)->&Vec<i32>{ foriin0..vectors.len(){ } vectors } Theindexhererepresentstheindexoftheminimumvalue: fninsert_sort(vectors:&mutVec<i32>)->&Vec<i32>{ foriin0..vectors.len(){ letmutindex=i; } vectors } Intheinnerloop,thenumberspecifiedbytheouterloopiscomparedwiththenumberontherightonebyone.Whenthenumberspecifiedbytheouterloopislessthantheelementontheright,thesubscriptoftheelementontherightisrecorded,otherwiseitdoesnotmove. Constantlycomparingwiththeelementsontherightisrepresentedbyforjini+1..vectors.len()andvectors[j]

Improve recall (Retrieval) and introduce reranking (Reranking) to improve the LLM application effect under the RAG architecture

Improve recall (Retrieval) and introduce reranking (Reranking) to improve the LLM application effect under RAG architecture Original ully AI engineering 2023-08-24 21:08 included in collection #LLM application architecture 3 #fieldtechnology13 Get hands-on and pay attention Don’t get lost with useful information As mentioned above, the origin and architecture of the retrieval enhancement (RAG) of the […]

Rust Algorithm Ranking – Illustration and Code Implementation of Insertion Sort

The writing process of Rust code is slightly different from that of other languages, because its compiler does not allow any unsafe writing methods, so the longest time spent in the code writing process is finding compilation errors. s reason. This also has advantages – after the code is written, the stability is greatly improved! […]